Class Task

  • Direct Known Subclasses:
    Adapter, Callback, Callback2

    public abstract class Task
    extends java.lang.Object
    Simple base task which contains logic for routing calls reflectively to ice_response and ice_exception of any AMD callback.
    Since:
    Beta4
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Object cb  
      protected Ice.Current current  
      protected java.lang.reflect.Method exception  
      protected boolean isVoid  
      protected java.lang.reflect.Method response  
    • Constructor Summary

      Constructors 
      Constructor Description
      Task​(java.lang.Object callback, Ice.Current current, boolean isVoid)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void exception​(java.lang.Throwable ex, ome.system.OmeroContext ctx)  
      protected java.lang.Object postProcess​(java.lang.Object rv)
      Can be overridden to transform the return value from the async method.
      protected void response​(java.lang.Object rv, ome.system.OmeroContext ctx)
      Calls the response method
      abstract void run​(ome.system.OmeroContext ctx)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • cb

        protected final java.lang.Object cb
      • isVoid

        protected final boolean isVoid
      • current

        protected final Ice.Current current
      • response

        protected final java.lang.reflect.Method response
      • exception

        protected final java.lang.reflect.Method exception
    • Constructor Detail

      • Task

        public Task​(java.lang.Object callback,
                    Ice.Current current,
                    boolean isVoid)
    • Method Detail

      • run

        public abstract void run​(ome.system.OmeroContext ctx)
      • response

        protected void response​(java.lang.Object rv,
                                ome.system.OmeroContext ctx)
        Calls the response method
      • postProcess

        protected java.lang.Object postProcess​(java.lang.Object rv)
                                        throws ServerError
        Can be overridden to transform the return value from the async method. This implementation leaves the return value unchanged.
        Parameters:
        rv - a return value
        Returns:
        the return value transformed
        Throws:
        ServerError - if the transformation failed
      • exception

        protected void exception​(java.lang.Throwable ex,
                                 ome.system.OmeroContext ctx)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object