com.bigdata.service.proxy
Class ClientFuture<T>
java.lang.Object
com.bigdata.service.proxy.ClientFuture<T>
- Type Parameters:
T -
- All Implemented Interfaces:
- Serializable, Future<T>
public class ClientFuture<T>
- extends Object
- implements Future<T>, Serializable
Serializable class wraps a RemoteFuture delegating
methods through to the Future on the remote service while
masquerading IOExceptions so that we can implement the
Future API.
- Version:
- $Id: ClientFuture.java 2265 2009-10-26 12:51:06Z thompsonbry $
- Author:
- Bryan Thompson
- See Also:
- Serialized Form
|
Field Summary |
protected static org.apache.log4j.Logger |
log
|
|
Method Summary |
boolean |
cancel(boolean mayInterruptIfRunning)
Note: I have observed problems where an attempt to cancel a remote future
fails when DGC is enabled. |
T |
get()
|
T |
get(long timeout,
TimeUnit unit)
|
boolean |
isCancelled()
|
boolean |
isDone()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static final transient org.apache.log4j.Logger log
ClientFuture
public ClientFuture(RemoteFuture<T> proxy)
- Parameters:
proxy - A proxy for the RemoteFuture.
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Note: I have observed problems where an attempt to cancel a remote future
fails when DGC is enabled. The stack trace looks like:
java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.rmi.NoSuchObjectException: no such object in table
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:232)
at java.util.concurrent.FutureTask.get(FutureTask.java:91)
at com.bigdata.service.proxy.RemoteFutureImpl.get(RemoteFutureImpl.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.jini.jeri.BasicInvocationDispatcher.invoke(BasicInvocationDispatcher.java:1126)
at net.jini.jeri.BasicInvocationDispatcher.dispatch(BasicInvocationDispatcher.java:608)
at com.sun.jini.jeri.internal.runtime.ObjectTable$6.run(ObjectTable.java:597)
at net.jini.export.ServerContext.doWithServerContext(ServerContext.java:103)
at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch0(ObjectTable.java:595)
at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.access$700(ObjectTable.java:212)
at com.sun.jini.jeri.internal.runtime.ObjectTable$5.run(ObjectTable.java:568)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:565)
at com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:540)
at com.sun.jini.jeri.internal.runtime.ObjectTable$RD.dispatch(ObjectTable.java:778)
at net.jini.jeri.connection.ServerConnectionManager$Dispatcher.dispatch(ServerConnectionManager.java:148)
at com.sun.jini.jeri.internal.mux.MuxServer$2.run(MuxServer.java:244)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.jini.jeri.internal.mux.MuxServer$1.run(MuxServer.java:241)
at com.sun.jini.thread.ThreadPool$Worker.run(ThreadPool.java:136)
at java.lang.Thread.run(Thread.java:619)
at com.sun.jini.jeri.internal.runtime.Util.__________EXCEPTION_RECEIVED_FROM_SERVER__________(Util.java:108)
at com.sun.jini.jeri.internal.runtime.Util.exceptionReceivedFromServer(Util.java:101)
at net.jini.jeri.BasicInvocationHandler.unmarshalThrow(BasicInvocationHandler.java:1303)
at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethodOnce(BasicInvocationHandler.java:832)
at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethod(BasicInvocationHandler.java:659)
at net.jini.jeri.BasicInvocationHandler.invoke(BasicInvocationHandler.java:528)
at $Proxy8.get(Unknown Source)
at com.bigdata.service.proxy.ClientFuture.get(ClientFuture.java:67)
at com.bigdata.relation.rule.eval.pipeline.JoinMasterTask.awaitAll(JoinMasterTask.java:528)
at com.bigdata.relation.rule.eval.pipeline.JoinMasterTask.call(JoinMasterTask.java:378)
at com.bigdata.relation.rule.eval.pipeline.JoinMasterTask.call(JoinMasterTask.java:236)
at com.bigdata.relation.rule.eval.AbstractStepTask.runOne(AbstractStepTask.java:331)
at com.bigdata.relation.rule.eval.MutationTask.call(MutationTask.java:113)
at com.bigdata.relation.rule.eval.MutationTask.call(MutationTask.java:55)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: java.rmi.NoSuchObjectException: no such object in table
at com.bigdata.service.proxy.ClientFuture.cancel(ClientFuture.java:48)
at com.bigdata.relation.rule.eval.pipeline.DistributedJoinTask.cancelSinks(DistributedJoinTask.java:956)
at com.bigdata.relation.rule.eval.pipeline.JoinTask.call(JoinTask.java:511)
at com.bigdata.relation.rule.eval.pipeline.JoinTask.call(JoinTask.java:128)
... 5 more
Caused by: java.rmi.NoSuchObjectException: no such object in table
at net.jini.jeri.BasicObjectEndpoint.executeCall(BasicObjectEndpoint.java:420)
at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethodOnce(BasicInvocationHandler.java:806)
at net.jini.jeri.BasicInvocationHandler.invokeRemoteMethod(BasicInvocationHandler.java:659)
at net.jini.jeri.BasicInvocationHandler.invoke(BasicInvocationHandler.java:528)
at $Proxy9.cancel(Unknown Source)
at com.bigdata.service.proxy.ClientFuture.cancel(ClientFuture.java:46)
... 8 more
This appears to be an RMI/DGC bug where the remote future is somehow
garbage collected even though this class is holding a reference to its
RemoteFuture proxy.
Since the remote future no longer exists we can assume that it is no
longer running. Therefore, I have modified this method to log a warning
and return false when this exception is thrown.
Note: I have also seen this problem where the stack trace involves
java.rmi.ConnectException.
- Specified by:
cancel in interface Future<T>
- See Also:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6181943,
http://archives.java.sun.com/cgi-bin/wa?A2=ind0509&L=rmi-users&P=617,
http://archives.java.sun.com/cgi-bin/wa?A2=ind0512&L=rmi-users&P=3747,
http://archives.java.sun.com/cgi-bin/wa?A2=ind0601&L=rmi-users&P=1985
get
public T get()
throws InterruptedException,
ExecutionException
- Specified by:
get in interface Future<T>
- Throws:
InterruptedException
ExecutionException
get
public T get(long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
- Specified by:
get in interface Future<T>
- Throws:
InterruptedException
ExecutionException
TimeoutException
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled in interface Future<T>
isDone
public boolean isDone()
- Specified by:
isDone in interface Future<T>
Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.