Minor modification.
1.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/ActiveSessions.java Wed Jan 29 19:02:49 2014 +0100
1.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/ActiveSessions.java Thu Jan 30 09:46:18 2014 +0100
1.3 @@ -97,11 +97,19 @@
1.4 Parameters.notNull("context", context); //NOI18N
1.5 Parameters.notNull("env", env); //NOI18N
1.6 final int id = sequencer.incrementAndGet();
1.7 - final Session session = DebuggerManager.getDebuggerManager().getCurrentSession();
1.8 - if (active.putIfAbsent(id, new Data(id, context, env, session)) != null) {
1.9 - throw new IllegalStateException("Trying to reuse active session"); //NOI18N
1.10 + for (int i = 0; i < 10; i++) {
1.11 + final Session session = DebuggerManager.getDebuggerManager().getCurrentSession();
1.12 + if (session != null) {
1.13 + if (active.putIfAbsent(id, new Data(id, context, env, session)) != null) {
1.14 + throw new IllegalStateException("Trying to reuse active session"); //NOI18N
1.15 + }
1.16 + return id;
1.17 + }
1.18 + try {
1.19 + Thread.sleep(2000);
1.20 + } catch (InterruptedException ex) {}
1.21 }
1.22 - return id;
1.23 + return -1;
1.24 }
1.25
1.26 @CheckForNull
2.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/AttachHandler.java Wed Jan 29 19:02:49 2014 +0100
2.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/AttachHandler.java Thu Jan 30 09:46:18 2014 +0100
2.3 @@ -71,7 +71,7 @@
2.4 throw new IllegalStateException("Wrong message type:" + type); //NOI18N
2.5 }
2.6 final Context ctx = request.getContext();
2.7 - if (ctx != null) {
2.8 + if (ctx == null) {
2.9 throw new IllegalArgumentException("Missing context"); //NOI18N
2.10 }
2.11 final String state = request.getState();
2.12 @@ -92,6 +92,8 @@
2.13 final FileObject workspace = resolver.resolveFile(serverCtx);
2.14 if (workspace != null) {
2.15 id = ActiveSessions.getInstance().createSession(serverCtx, env);
2.16 + }
2.17 + if (id >= 0) {
2.18 status = Status.done;
2.19 }
2.20 final AttachResult attachResult = new AttachResult();