You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/05/31 16:11:57 UTC
svn commit: r1129683 - in /commons/sandbox/runtime/trunk/src/main:
java/org/apache/commons/runtime/net/ native/include/acr/ native/os/unix/
Author: mturk
Date: Tue May 31 14:11:57 2011
New Revision: 1129683
URL: http://svn.apache.org/viewvc?rev=1129683&view=rev
Log:
Use reset instead detach for method name
Modified:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketEndpoint.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SelectionKeyImpl.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketEndpoint.java
commons/sandbox/runtime/trunk/src/main/native/include/acr/misc.h
commons/sandbox/runtime/trunk/src/main/native/os/unix/selectkey.c
commons/sandbox/runtime/trunk/src/main/native/os/unix/selector.c
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketEndpoint.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketEndpoint.java?rev=1129683&r1=1129682&r2=1129683&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketEndpoint.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketEndpoint.java Tue May 31 14:11:57 2011
@@ -115,10 +115,13 @@ public class LocalSocketEndpoint extends
} catch (Exception e) {
// Ignore selector exceptions
}
- key = null;
}
}
sd.close();
+ if (key != null) {
+ key.reset();
+ key = null;
+ }
}
}
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SelectionKeyImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SelectionKeyImpl.java?rev=1129683&r1=1129682&r2=1129683&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SelectionKeyImpl.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SelectionKeyImpl.java Tue May 31 14:11:57 2011
@@ -90,7 +90,7 @@ final class SelectionKeyImpl extends Sel
* Called from the Selector.close() native method for all currently
* registered keys.
*/
- private void detach()
+ public void reset()
{
revents = 0;
selected = false;
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketEndpoint.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketEndpoint.java?rev=1129683&r1=1129682&r2=1129683&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketEndpoint.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketEndpoint.java Tue May 31 14:11:57 2011
@@ -111,10 +111,13 @@ public class SocketEndpoint extends Endp
} catch (Exception e) {
// Ignore selector exceptions
}
- key = null;
}
}
sd.close();
+ if (key != null) {
+ key.reset();
+ key = null;
+ }
}
}
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr/misc.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr/misc.h?rev=1129683&r1=1129682&r2=1129683&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr/misc.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr/misc.h Tue May 31 14:11:57 2011
@@ -29,7 +29,7 @@ ACR_CLASS_DTOR(HashSet);
int AcrArrayListAdd(JNI_STDARGS, jobject e);
int AcrHashSetAdd(JNI_STDARGS, jobject e);
-void AcrSelectionKeyDetach(JNI_STDARGS);
+void AcrSelectionKeyReset(JNI_STDARGS);
void AcrLibLockAcquire(void);
void AcrLibLockRelease(void);
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/selectkey.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/selectkey.c?rev=1129683&r1=1129682&r2=1129683&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/selectkey.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/selectkey.c Tue May 31 14:11:57 2011
@@ -29,7 +29,7 @@ J_DECLARE_CLAZZ = {
J_DECLARE_M_ID(0000) = {
0,
- "detach",
+ "reset",
"()V"
};
@@ -43,9 +43,11 @@ ACR_NET_EXPORT(void, SelectionKeyImpl, i
}
void
-AcrSelectionKeyDetach(JNI_STDARGS)
+AcrSelectionKeyReset(JNI_STDARGS)
{
- if (CLAZZ_LOADED) {
+ if (CLAZZ_LOADED && obj != 0) {
CALL_VMETHOD0(0000, obj);
+ if (IS_EXCEPTION_PENDING(env))
+ (*env)->ExceptionClear(env);
}
}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/selector.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/selector.c?rev=1129683&r1=1129682&r2=1129683&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/selector.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/selector.c Tue May 31 14:11:57 2011
@@ -188,7 +188,7 @@ ACR_NET_EXPORT(int, PosixSelector, destr
}
ps->state = PSS_DESTROY;
for (i = 1; i < ps->used; i++) {
- AcrSelectionKeyDetach(env, ps->ooset[i].obj);
+ AcrSelectionKeyReset(env, ps->ooset[i].obj);
/* Invalidate the container. */
(*env)->DeleteGlobalRef(env, ps->ooset[i].obj);
}