我们最近将CF(Cloud Foundry)构建包从cflinuxfs2升级到了cflinuxfs3。这将Java buildpack从java-buildpack.git#v4.8更改为java-buildpack.git#v4.16.1。 CF容器中的Java版本从1.8.0_162-b12更改为1.8.0_192-b12。
此升级后,我们面临Akka Futures的一个奇怪问题。尽管多个请求同时提交给Akka Future,但是Future中的请求执行顺序发生。调用点没有被阻止,但是第二个请求的Future执行被阻止,直到第一个Future请求执行完成。
cflinuxfs2中的示例输出:(两个请求都同时执行)
创造…一个
收到未来请求:一个
创造…两个
收到的未来请求:两个
未来请求完成:一个
未来请求完成:两次
成功-一个
成功-两个
cflinuxfs3中的示例输出:(两个请求同时提交,但执行顺序发生)
创造…一个
收到未来请求:一个
创造…两个
未来请求完成:一个
成功-一个
收到的未来请求:两个
未来请求完成:两次
成功-两个
示例代码:
package com.local.xspac.shopapp;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public abstract class MainActivity extends AppCompatActivity {
String[] listviewTitle = new String[] {
"Shop One", "Shop Two", "Shop Three", "Shop Four",
"Shop Five", "Shop Six", "Shop Seven", "Shop Eight",
};
String[] listviewURL = new String[] {
"https://google.com", "https://bing.com", "https://yahoo.com", "https://duckduckgo.com", "https://stackoverflow.com/",
"https://thehackernews.com", "https://techviral.net", "https://amazon.in",
};
String[] listviewShortDescription = new String[]{
"Shop One Short Description", "Shop Two Short Description", "Shop Three Short Description", "Shop Four Short Description",
"Shop Five Short Description", "Shop Six Short Description", "Shop Seven Short Description", "Shop Eight Short Description",
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
List<HashMap<String, String>> aList = new ArrayList<>();
for (int i = 0; i < 8; i++) {
HashMap<String, String> hm = new HashMap<String, String>();
hm.put("listview_title", listviewTitle[i]);
hm.put("listview_discription", listviewShortDescription[i]);
hm.put("listview_url", listviewURL[i]);
aList.add(hm);
}
//String[] from = {"listview_image", "listview_title", "listview_description"};
String[] from = {"listview_url", "listview_title", "listview_discription"};
int[] to = {R.id.listview_item_url, R.id.listview_item_title, R.id.listview_item_short_description};
//int[] to = {R.id.listview_item_title, R.id.listview_item_short_description};
SimpleAdapter simpleAdapter = new SimpleAdapter(getBaseContext(), aList, R.layout.listview_activity, from, to);
ListView androidListView = (ListView) findViewById(R.id.list_view);
androidListView.setAdapter(simpleAdapter);
androidListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
public void onItemClick(AdapterView<?> parent, View view, int position, long id){
//
}
});
}
public void buttonClick(View view) {
String currentURL = null;
ViewGroup parent = (ViewGroup) view.getParent();
TextView child = (TextView) parent.findViewById(R.id.listview_item_url);
currentURL = child.getText().toString();
Intent logwebview = new Intent(MainActivity.this, WebViewActivity.class);
logwebview.putExtra("CurrentUrL",String.valueOf(currentURL));
startActivity(logwebview);
}
public void fetchClick (View view) {
Intent fetchDetails = new Intent(MainActivity.this, API.class);
startActivity(fetchDetails);
}
}