diff --git a/src/com/neocoretechs/relatrix/client/RelatrixKVStatement.java b/src/com/neocoretechs/relatrix/client/RelatrixKVStatement.java index db35ae1..a804b93 100644 --- a/src/com/neocoretechs/relatrix/client/RelatrixKVStatement.java +++ b/src/com/neocoretechs/relatrix/client/RelatrixKVStatement.java @@ -42,13 +42,13 @@ public RelatrixKVStatement(String tmeth, Object ... o1) { * @see com.neocoretechs.relatrix.client.RemoteRequestInterface#getClassName() */ @Override - public String getClassName() { return className; } + public synchronized String getClassName() { return className; } /* (non-Javadoc) * @see com.neocoretechs.relatrix.client.RemoteRequestInterface#getSession() */ @Override - public String getSession() { + public synchronized String getSession() { if( session == null ) { session = UUID.randomUUID().toString(); if( DEBUG ) @@ -57,24 +57,24 @@ public String getSession() { return session; } - protected void setSession(String session) { this.session = session; } + protected synchronized void setSession(String session) { this.session = session; } /* (non-Javadoc) * @see com.neocoretechs.relatrix.client.RemoteRequestInterface#getMethodName() */ @Override - public String getMethodName() { return methodName; } + public synchronized String getMethodName() { return methodName; } /* (non-Javadoc) * @see com.neocoretechs.relatrix.client.RemoteRequestInterface#getParamArray() */ @Override - public Object[] getParamArray() { return paramArray; } + public synchronized Object[] getParamArray() { return paramArray; } /* (non-Javadoc) * @see com.neocoretechs.relatrix.client.RemoteRequestInterface#getParams() */ @Override - public Class[] getParams() { + public synchronized Class[] getParams() { //System.out.println("params:"+paramArray.length); //for(int i = 0; i < paramArray.length; i++) //System.out.println("paramArray "+i+"="+paramArray[i]); @@ -84,42 +84,42 @@ public Class[] getParams() { return c; } @Override - public String toString() { return String.format("%s for Session:%s Class:%s Method:%s Arg:%s%n", + public synchronized String toString() { return String.format("%s for Session:%s Class:%s Method:%s Arg:%s%n", this.getClass().getName(),session,className,methodName, (paramArray == null || paramArray.length == 0 ? "nil" : (paramArray[0] == null ? "NULL PARAM!" : paramArray[0]))); } @Override - public CountDownLatch getCountDownLatch() { + public synchronized CountDownLatch getCountDownLatch() { return latch; } @Override - public void setCountDownLatch(CountDownLatch cdl) { + public synchronized void setCountDownLatch(CountDownLatch cdl) { latch = cdl; } @Override - public CyclicBarrier getCyclicBarrier() { + public synchronized CyclicBarrier getCyclicBarrier() { return barrier; } @Override - public void setCyclicBarrier(CyclicBarrier cb) { + public synchronized void setCyclicBarrier(CyclicBarrier cb) { barrier = cb; } @Override - public void setLongReturn(long val) { + public synchronized void setLongReturn(long val) { retLong = val; } @Override - public void setObjectReturn(Object o) { + public synchronized void setObjectReturn(Object o) { retObj = o; } @Override - public long getLongReturn() { + public synchronized long getLongReturn() { return retLong; } @Override - public Object getObjectReturn() { + public synchronized Object getObjectReturn() { return retObj; } /** @@ -133,7 +133,7 @@ public Object getObjectReturn() { * because the functionality is available in whole, and we dont have to add the morphism processing aspect. */ @Override - public void process() throws Exception { + public synchronized void process() throws Exception { Object result = RelatrixKVServer.relatrixMethods.invokeMethod(this); // See if we are dealing with an object that must be remotely maintained, e.g. iterator // which does not serialize so we front it diff --git a/src/com/neocoretechs/relatrix/client/RelatrixStatement.java b/src/com/neocoretechs/relatrix/client/RelatrixStatement.java index 57fa027..d39c5f7 100644 --- a/src/com/neocoretechs/relatrix/client/RelatrixStatement.java +++ b/src/com/neocoretechs/relatrix/client/RelatrixStatement.java @@ -42,12 +42,12 @@ public RelatrixStatement(String tmeth, Object ... o1) { * @see com.neocoretechs.relatrix.client.RemoteRequestInterface#getClassName() */ @Override - public String getClassName() { return className; } + public synchronized String getClassName() { return className; } /* (non-Javadoc) * @see com.neocoretechs.relatrix.client.RemoteRequestInterface#getSession() */ @Override - public String getSession() { + public synchronized String getSession() { if( session == null ) { session = UUID.randomUUID().toString(); if( DEBUG ) @@ -56,24 +56,24 @@ public String getSession() { return session; } - protected void setSession(String session) { this.session = session; } + protected synchronized void setSession(String session) { this.session = session; } /* (non-Javadoc) * @see com.neocoretechs.relatrix.client.RemoteRequestInterface#getMethodName() */ @Override - public String getMethodName() { return methodName; } + public synchronized String getMethodName() { return methodName; } /* (non-Javadoc) * @see com.neocoretechs.relatrix.client.RemoteRequestInterface#getParamArray() */ @Override - public Object[] getParamArray() { return paramArray; } + public synchronized Object[] getParamArray() { return paramArray; } /* (non-Javadoc) * @see com.neocoretechs.relatrix.client.RemoteRequestInterface#getParams() */ @Override - public Class[] getParams() { + public synchronized Class[] getParams() { //System.out.println("params:"+paramArray.length); //for(int i = 0; i < paramArray.length; i++) //System.out.println("paramArray "+i+"="+paramArray[i]); @@ -83,42 +83,42 @@ public Class[] getParams() { return c; } @Override - public String toString() { return String.format("%s for Session:%s Class:%s Method:%s Arg:%s%n", + public synchronized String toString() { return String.format("%s for Session:%s Class:%s Method:%s Arg:%s%n", this.getClass().getName(),session,className,methodName, (paramArray == null || paramArray.length == 0 ? "nil" : (paramArray[0] == null ? "NULL PARAM!" : paramArray[0]))); } @Override - public CountDownLatch getCountDownLatch() { + public synchronized CountDownLatch getCountDownLatch() { return latch; } @Override - public void setCountDownLatch(CountDownLatch cdl) { + public synchronized void setCountDownLatch(CountDownLatch cdl) { latch = cdl; } @Override - public CyclicBarrier getCyclicBarrier() { + public synchronized CyclicBarrier getCyclicBarrier() { return barrier; } @Override - public void setCyclicBarrier(CyclicBarrier cb) { + public synchronized void setCyclicBarrier(CyclicBarrier cb) { barrier = cb; } @Override - public void setLongReturn(long val) { + public synchronized void setLongReturn(long val) { retLong = val; } @Override - public void setObjectReturn(Object o) { + public synchronized void setObjectReturn(Object o) { retObj = o; } @Override - public long getLongReturn() { + public synchronized long getLongReturn() { return retLong; } @Override - public Object getObjectReturn() { + public synchronized Object getObjectReturn() { return retObj; } /** @@ -126,7 +126,7 @@ public Object getObjectReturn() { * in which case we save it server side and link it to the session for later retrieval */ @Override - public void process() throws Exception { + public synchronized void process() throws Exception { Object result = RelatrixServer.relatrixMethods.invokeMethod(this); // See if we are dealing with an object that must be remotely maintained, e.g. iterator // which does not serialize so we front it diff --git a/src/com/neocoretechs/relatrix/key/IndexInstanceTable.java b/src/com/neocoretechs/relatrix/key/IndexInstanceTable.java index 4097e37..9ff8271 100644 --- a/src/com/neocoretechs/relatrix/key/IndexInstanceTable.java +++ b/src/com/neocoretechs/relatrix/key/IndexInstanceTable.java @@ -17,7 +17,7 @@ * */ public final class IndexInstanceTable implements IndexInstanceTableInterface { - public static boolean DEBUG = true; + public static boolean DEBUG = false; LinkedHashSet classCommits = new LinkedHashSet(); DBKey lastKey; DBKey lastGoodKey; diff --git a/src/com/neocoretechs/relatrix/server/ServerInvokeMethod.java b/src/com/neocoretechs/relatrix/server/ServerInvokeMethod.java index 8766ee7..bcc8de5 100644 --- a/src/com/neocoretechs/relatrix/server/ServerInvokeMethod.java +++ b/src/com/neocoretechs/relatrix/server/ServerInvokeMethod.java @@ -33,7 +33,7 @@ public final class ServerInvokeMethod { */ public ServerInvokeMethod(String tclass, int tskipArgs) throws ClassNotFoundException { //pkmnap.classClass = Class.forName(tclass); - // if we cant load it with handlerclassloader, it cant be loded. period. + // Use custom classloader? pkmnap.classClass = hcl.loadClass(tclass, true); pkmnap.className = pkmnap.classClass.getName(); skipArgs = tskipArgs; @@ -84,7 +84,7 @@ public ServerInvokeMethod(String tclass, int tskipArgs) throws ClassNotFoundExce * @return * @throws Exception */ - public Object invokeMethod(RemoteRequestInterface tmc) throws Exception { + public synchronized Object invokeMethod(RemoteRequestInterface tmc) throws Exception { return invokeMethod(tmc, null); } /** @@ -93,7 +93,7 @@ public Object invokeMethod(RemoteRequestInterface tmc) throws Exception { * it has been used to locate this object. * @return Object of result of method invocation */ - public Object invokeMethod(RemoteRequestInterface tmc, Object localObject) throws Exception { + public synchronized Object invokeMethod(RemoteRequestInterface tmc, Object localObject) throws Exception { //NoSuchMethodException, InvocationTargetException, IllegalAccessException, PowerSpaceException { String targetMethod = tmc.getMethodName(); int methodIndex = pkmnap.methodNames.indexOf(targetMethod); diff --git a/src/com/neocoretechs/relatrix/test/EmbeddedRetrievalBattery.java b/src/com/neocoretechs/relatrix/test/EmbeddedRetrievalBattery.java index aee40b0..0fd1a10 100644 --- a/src/com/neocoretechs/relatrix/test/EmbeddedRetrievalBattery.java +++ b/src/com/neocoretechs/relatrix/test/EmbeddedRetrievalBattery.java @@ -48,25 +48,26 @@ public static void battery1(String[] argv) throws Exception { rkvc = new RelatrixClient(argv[0], argv[1], Integer.parseInt(argv[2]) ); RemoteTailSetIterator it = null; System.out.println("Wildcard queries:"); - - System.out.println("1.) Findset(*,*,*)..."); - it = rkvc.findSet("*", "*", "*"); + + System.out.println("2.) Findset(*,*,?)..."); + it = rkvc.findSet("*", "*", "?"); + //ar = new ArrayList(); while(rkvc.hasNext(it)) { Object o = rkvc.next(it); Comparable[] c = (Comparable[])o; System.out.println(++recs+"="+c[0]); - //ar.add(c[0]); + if(ar.size() == 0 ) ar.add(c[0]); } - System.out.println("2.) Findset(*,*,?)..."); - it = rkvc.findSet("*", "*", "?"); - //ar = new ArrayList(); + System.out.println("1.) Findset(*,*,*)..."); + it = rkvc.findSet("*", "*", "*"); while(rkvc.hasNext(it)) { Object o = rkvc.next(it); Comparable[] c = (Comparable[])o; System.out.println(++recs+"="+c[0]); - if(ar.size() == 0 ) ar.add(c[0]); + //ar.add(c[0]); } + System.out.println("3.) Findset(*,?,*)..."); it = rkvc.findSet("*", "?", "*"); //ar = new ArrayList();