org.indy
Class AbstractPeerThreadManager
java.lang.Object
|
+--org.indy.BaseComponent
|
+--org.indy.AbstractPeerThreadManager
- All Implemented Interfaces:
- PeerThreadManager
- Direct Known Subclasses:
- DefaultPeerThreadManager
- public abstract class AbstractPeerThreadManager
- extends BaseComponent
- implements PeerThreadManager
Provides a skeletal implementation of the ThreadManager
interface
that clients can use as the basis for their own implementations.
- Version:
- 1.0
- Author:
- OTG
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractPeerThreadManager
public AbstractPeerThreadManager()
setThreadFactory
public void setThreadFactory(PeerThreadFactory factory)
- Sets the
ThreadFactory
to use for this manager.
- Specified by:
setThreadFactory
in interface PeerThreadManager
- Parameters:
factory
-
getThreadFactory
public PeerThreadFactory getThreadFactory()
- Returns the
ThreadFactory
instance used by this ThreadManager
- Specified by:
getThreadFactory
in interface PeerThreadManager
- Returns:
- The
ThreadFactory
getThread
public abstract PeerThread getThread()
- Returns a new thread from the manager. Clients must provide an implementation of this method.
The exact behaviour of this will depend on the implementation.
- Specified by:
getThread
in interface PeerThreadManager
- Returns:
- A thread.
createNewThread
protected PeerThread createNewThread()
- A conviencie method for descendents to create new threads with their priority set.
Uses the associated
ThreadFactory
instance to create a new thread and sets its priority.
- Returns:
- A new
PeerThread
instance from the ThreadFacotry
releaseThread
public abstract void releaseThread(PeerThread thread)
throws java.lang.InterruptedException
- Returns a thread to this
ThreadManager
.
Descendents need to provide their own implementation of this method.
- Specified by:
releaseThread
in interface PeerThreadManager
- Parameters:
thread
- The thread to return to the ThreadManager
getPriority
public IndyThread.Priority getPriority()
- Returns the
Priority
for threads provided by this ThreadManager
- Specified by:
getPriority
in interface PeerThreadManager
- Returns:
- The priority for threads returned by this manager.
setPriority
public void setPriority(IndyThread.Priority p)
- Sets the
Priority
for threads returned by this manager.
- Specified by:
setPriority
in interface PeerThreadManager
- Parameters:
p
- The new Priority
Copyright © 2002-2002 IndyJ. All Rights Reserved.