Skip to content

Commit b73035d

Browse files
ServiceDiscoveryのタイムアウトを3000msecに設定する。
1 parent 71e9a19 commit b73035d

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

  • dConnectManager/dConnectManager/dconnect-manager-core/src/main/java/org/deviceconnect/android/manager/core/request

dConnectManager/dConnectManager/dconnect-manager-core/src/main/java/org/deviceconnect/android/manager/core/request/ServiceDiscoveryRequest.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public class ServiceDiscoveryRequest extends DConnectRequest {
4444
private final Logger mLogger = Logger.getLogger("dconnect.manager");
4545

4646
/**
47-
* タイムアウト時間を定義. (8秒)
47+
* タイムアウト時間を定義. (3秒)
4848
*/
49-
public static final int TIMEOUT = 8000;
49+
public static final int TIMEOUT = 3000;
5050

5151
/**
5252
* プラグイン側のService Discoveryのプロファイル名: {@value}.
@@ -122,11 +122,9 @@ public void run() {
122122
}
123123
}
124124

125-
// レスポンスの無かったプラグインのログを出力
126-
if (BuildConfig.DEBUG) {
127-
synchronized (mRequestCodeArray) {
128-
outputNotRespondedPlugins(mRequestCodeArray);
129-
}
125+
// レスポンスの無かったプラグインをOFFにする
126+
synchronized (mRequestCodeArray) {
127+
outputNotRespondedPlugins(mRequestCodeArray);
130128
}
131129

132130
// パラメータを設定する
@@ -150,10 +148,13 @@ private void outputNotRespondedPlugins(final SparseArray<DevicePlugin> notRespon
150148
for (int index = 0; index < notRespondedPlugins.size(); index++) {
151149
DevicePlugin plugin = notRespondedPlugins.get(notRespondedPlugins.keyAt(index));
152150
if (plugin != null) {
151+
plugin.disable();
153152
notRespondedLog.append(" - ").append(plugin.getDeviceName()).append("\n");
154153
}
155154
}
156-
mLogger.warning(notRespondedLog.toString());
155+
if (BuildConfig.DEBUG) {
156+
mLogger.warning(notRespondedLog.toString());
157+
}
157158
} else {
158159
if (BuildConfig.DEBUG) {
159160
mLogger.info("All plug-in(s) responded for service discovery.");
@@ -206,18 +207,18 @@ protected void onResponseReceived(final Intent request, final Intent response) {
206207
}
207208

208209
// レスポンス個数を追加
209-
mCountDownLatch.countDown();
210210
synchronized (mRequestCodeArray) {
211211
mRequestCodeArray.remove(mRequestCode);
212212
}
213+
mCountDownLatch.countDown();
213214
}
214215

215216
@Override
216217
protected void onMessagingError(final MessagingException e) {
217-
mCountDownLatch.countDown();
218218
synchronized (mRequestCodeArray) {
219219
mRequestCodeArray.remove(mRequestCode);
220220
}
221+
mCountDownLatch.countDown();
221222
}
222223
}
223224
}

0 commit comments

Comments
 (0)