com.hazelcast.executor.impl
Class RunnableAdapter<V>

java.lang.Object
  extended by com.hazelcast.executor.impl.RunnableAdapter<V>
Type Parameters:
V -
All Implemented Interfaces:
HazelcastInstanceAware, DataSerializable, IdentifiedDataSerializable, Callable<V>

public final class RunnableAdapter<V>
extends Object
implements IdentifiedDataSerializable, Callable<V>, HazelcastInstanceAware

An adapter that adapts a Runnable to become a Callable.


Constructor Summary
RunnableAdapter()
           
RunnableAdapter(Runnable task)
           
 
Method Summary
 V call()
           
 int getFactoryId()
          Returns DataSerializableFactory factory id for this class.
 int getId()
          Returns type identifier for this class.
 Runnable getRunnable()
           
 void readData(ObjectDataInput in)
          Reads fields from the input stream
 void setHazelcastInstance(HazelcastInstance hazelcastInstance)
          Gets the HazelcastInstance reference when submitting a Runnable/Callable using Hazelcast ExecutorService.
 void setRunnable(Runnable runnable)
           
 String toString()
           
 void writeData(ObjectDataOutput out)
          Writes object fields to output stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RunnableAdapter

public RunnableAdapter()

RunnableAdapter

public RunnableAdapter(Runnable task)
Method Detail

getRunnable

public Runnable getRunnable()

setRunnable

public void setRunnable(Runnable runnable)

call

public V call()
       throws Exception
Specified by:
call in interface Callable<V>
Throws:
Exception

setHazelcastInstance

public void setHazelcastInstance(HazelcastInstance hazelcastInstance)
Description copied from interface: HazelcastInstanceAware
Gets the HazelcastInstance reference when submitting a Runnable/Callable using Hazelcast ExecutorService.

Specified by:
setHazelcastInstance in interface HazelcastInstanceAware
Parameters:
hazelcastInstance - the HazelcastInstance reference

writeData

public void writeData(ObjectDataOutput out)
               throws IOException
Description copied from interface: DataSerializable
Writes object fields to output stream

Specified by:
writeData in interface DataSerializable
Parameters:
out - output
Throws:
IOException

readData

public void readData(ObjectDataInput in)
              throws IOException
Description copied from interface: DataSerializable
Reads fields from the input stream

Specified by:
readData in interface DataSerializable
Parameters:
in - input
Throws:
IOException

getFactoryId

public int getFactoryId()
Description copied from interface: IdentifiedDataSerializable
Returns DataSerializableFactory factory id for this class.

Specified by:
getFactoryId in interface IdentifiedDataSerializable
Returns:
factory id

getId

public int getId()
Description copied from interface: IdentifiedDataSerializable
Returns type identifier for this class. Id should be unique per DataSerializableFactory.

Specified by:
getId in interface IdentifiedDataSerializable
Returns:
type id

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.