omero.grid
Class DeleteCallbackI

java.lang.Object
  extended by omero.grid.DeleteCallbackI

public class DeleteCallbackI
extends Object

Callback used for waiting until DeleteHandlePrx will return true on DeleteHandlePrx.finished(). The block(long) method will wait the given number of milliseconds and then return the number of errors if any or null if the delete is not yet complete. Example usage:

 DeleteCallbackI cb = new DeleteCallbackI(client, handle);
 Integer errors = null;
 while (errors == null) {
     errors = cb.block(500);
 }
 

Since:
Beta4.2.1
Author:
Josh Moore, josh at glencoesoftware.com

Field Summary
protected  omero.api.delete.DeleteHandlePrx handle
          Proxy passed to this instance on creation.
 
Constructor Summary
DeleteCallbackI(client client, omero.api.delete.DeleteHandlePrx handle)
           
 
Method Summary
 Integer block(long ms)
          Should only be used if the default logic of the process methods is kept in place.
 void close()
           
 void finished(int errors)
          Client method to be overwritten when block is returning a non-null.
 omero.api.delete.DeleteReport[] loop(int loops, long ms)
          Calls block(long) "loops" number of times with the "ms" argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handle

protected final omero.api.delete.DeleteHandlePrx handle
Proxy passed to this instance on creation. Can be used by subclasses freely. The object will not be nulled, but may be closed server-side.

Constructor Detail

DeleteCallbackI

public DeleteCallbackI(client client,
                       omero.api.delete.DeleteHandlePrx handle)
                throws omero.ServerError
Throws:
omero.ServerError
Method Detail

loop

public omero.api.delete.DeleteReport[] loop(int loops,
                                            long ms)
                                     throws omero.LockTimeout,
                                            omero.ServerError
Calls block(long) "loops" number of times with the "ms" argument. This means the total wait time for the delete to occur is: loops X ms. Sensible values might be 10 loops for 500 ms, or 5 seconds.

Parameters:
loops - Number of times to call block(long)
ms - Number of milliseconds to pass to {@link #block(long)
Throws:
omero.LockTimeout - if block(long) does not return a non-null value after loops calls.
omero.ServerError

block

public Integer block(long ms)
              throws InterruptedException
Should only be used if the default logic of the process methods is kept in place. If "q.put" does not get called, this method will always block for the given milliseconds.

Parameters:
ms -
Returns:
Throws:
InterruptedException

finished

public void finished(int errors)
Client method to be overwritten when block is returning a non-null.


close

public void close()


OmeroJava Api

Version: 4.3.4-dbcbce5a-b4

Copyright © 2009 The University of Dundee. All Rights Reserved.