Java Doc for GroupChannel.java in  » Sevlet-Container » apache-tomcat-6.0.14 » org » apache » catalina » tribes » group » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Sevlet Container » apache tomcat 6.0.14 » org.apache.catalina.tribes.group 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.catalina.tribes.group.ChannelInterceptorBase
      org.apache.catalina.tribes.group.GroupChannel

GroupChannel
public class GroupChannel extends ChannelInterceptorBase implements ManagedChannel(Code)
The default implementation of a Channel.
The GroupChannel manages the replication channel. It coordinates message being sent and received with membership announcements. The channel has an chain of interceptors that can modify the message or perform other logic.
It manages a complete group, both membership and replication.
author:
   Filip Hanik
version:
   $Revision: 500684 $, $Date: 2007-01-28 00:27:18 +0100 (dim., 28 janv. 2007) $

Inner Class :public static class InterceptorIterator implements Iterator
Inner Class :public static class HeartbeatThread extends Thread

Field Summary
protected  ArrayListchannelListeners
    
protected  ChannelCoordinatorcoordinator
    
protected  HeartbeatThreadhbthread
    
protected  booleanheartbeat
     Flag to determine if the channel manages its own heartbeat If set to true, the channel will start a local thread for the heart beat.
protected  longheartbeatSleeptime
     If heartbeat == true then how often do we want this heartbeat to run.
protected  ChannelInterceptorinterceptors
     The first interceptor in the inteceptor stack.
protected  ArrayListmembershipListeners
    
protected  booleanoptionCheck
    

Constructor Summary
public  GroupChannel()
     Creates a GroupChannel.

Method Summary
public  voidaddChannelListener(ChannelListener channelListener)
    
public  voidaddInterceptor(ChannelInterceptor interceptor)
    
public  voidaddMembershipListener(MembershipListener membershipListener)
    
protected  voidcheckOptionFlags()
     Validates the option flags that each interceptor is using and reports an error if two interceptor share the same flag.
public  ChannelReceivergetChannelReceiver()
    
public  ChannelSendergetChannelSender()
    
public  ChannelInterceptorgetFirstInterceptor()
     Returns the first interceptor of the stack.
public  booleangetHeartbeat()
    
public  longgetHeartbeatSleeptime()
    
public  IteratorgetInterceptors()
    
public  MembershipServicegetMembershipService()
    
public  booleangetOptionCheck()
    
public  voidheartbeat()
    
public  voidmemberAdded(Member member)
    
public  voidmemberDisappeared(Member member)
    
public  voidmessageReceived(ChannelMessage msg)
     Callback from the interceptor stack.
public  voidremoveChannelListener(ChannelListener channelListener)
    
public  voidremoveMembershipListener(MembershipListener membershipListener)
    
public  UniqueIdsend(Member[] destination, Serializable msg, int options)
    
public  UniqueIdsend(Member[] destination, Serializable msg, int options, ErrorHandler handler)
    
Parameters:
  destination - Member[] - destination.length > 1
Parameters:
  msg - Serializable - the message to send
Parameters:
  options - int - sender options, options can trigger guarantee levels and different interceptors toreact to the message see class documentation for the Channel object.

Parameters:
  handler - - callback object for error handling and completion notification, used when a message issent asynchronously using the Channel.SEND_OPTIONS_ASYNCHRONOUS flag enabled.
protected  voidsendNoRpcChannelReply(RpcMessage msg, Member destination)
     Sends a NoRpcChannelReply message to a member
This method gets invoked by the channel if a RPC message comes in and no channel listener accepts the message.
public  voidsetChannelReceiver(ChannelReceiver clusterReceiver)
    
public  voidsetChannelSender(ChannelSender clusterSender)
    
public  voidsetHeartbeat(boolean heartbeat)
     Enables or disables local heartbeat.
public  voidsetHeartbeatSleeptime(long heartbeatSleeptime)
    
public  voidsetMembershipService(MembershipService membershipService)
    
public  voidsetOptionCheck(boolean optionCheck)
     Enables/disables the option check
Setting this to true, will make the GroupChannel perform a conflict check on the interceptors.
protected synchronized  voidsetupDefaultStack()
    
public synchronized  voidstart(int svc)
    
public synchronized  voidstop(int svc)
    

Field Detail
channelListeners
protected ArrayList channelListeners(Code)
A list of channel listeners that subscribe to incoming messages



coordinator
protected ChannelCoordinator coordinator(Code)
The ChannelCoordinator coordinates the bottom layer components:
- MembershipService
- ChannelSender
- ChannelReceiver



hbthread
protected HeartbeatThread hbthread(Code)
Internal heartbeat thread



heartbeat
protected boolean heartbeat(Code)
Flag to determine if the channel manages its own heartbeat If set to true, the channel will start a local thread for the heart beat.



heartbeatSleeptime
protected long heartbeatSleeptime(Code)
If heartbeat == true then how often do we want this heartbeat to run. default is one minute



interceptors
protected ChannelInterceptor interceptors(Code)
The first interceptor in the inteceptor stack. The interceptors are chained in a linked list, so we only need a reference to the first one



membershipListeners
protected ArrayList membershipListeners(Code)
A list of membership listeners that subscribe to membership announcements



optionCheck
protected boolean optionCheck(Code)
If set to true, the GroupChannel will check to make sure that




Constructor Detail
GroupChannel
public GroupChannel()(Code)
Creates a GroupChannel. This constructor will also add the first interceptor in the GroupChannel.
The first interceptor is always the channel itself.




Method Detail
addChannelListener
public void addChannelListener(ChannelListener channelListener)(Code)
Adds a channel listener to the channel.
Channel listeners are uniquely identified using the equals(Object) method
Parameters:
  channelListener - ChannelListener



addInterceptor
public void addInterceptor(ChannelInterceptor interceptor)(Code)
Adds an interceptor to the stack for message processing
Interceptors are ordered in the way they are added.
channel.addInterceptor(A);
channel.addInterceptor(C);
channel.addInterceptor(B);
Will result in a interceptor stack like this:
A -> C -> B
The complete stack will look like this:
Channel -> A -> C -> B -> ChannelCoordinator

Parameters:
  interceptor - ChannelInterceptorBase



addMembershipListener
public void addMembershipListener(MembershipListener membershipListener)(Code)
Adds a membership listener to the channel.
Membership listeners are uniquely identified using the equals(Object) method
Parameters:
  membershipListener - MembershipListener



checkOptionFlags
protected void checkOptionFlags() throws ChannelException(Code)
Validates the option flags that each interceptor is using and reports an error if two interceptor share the same flag.
throws:
  ChannelException -



getChannelReceiver
public ChannelReceiver getChannelReceiver()(Code)
Returns the channel receiver component ChannelReceiver



getChannelSender
public ChannelSender getChannelSender()(Code)
Returns the channel sender component ChannelSender



getFirstInterceptor
public ChannelInterceptor getFirstInterceptor()(Code)
Returns the first interceptor of the stack. Useful for traversal. ChannelInterceptor



getHeartbeat
public boolean getHeartbeat()(Code)

See Also:   GroupChannel.setHeartbeat(boolean) boolean



getHeartbeatSleeptime
public long getHeartbeatSleeptime()(Code)
Returns the sleep time in milliseconds that the internal heartbeat will sleep in between invokations of Channel.heartbeat() long



getInterceptors
public Iterator getInterceptors()(Code)
Returns an iterator of all the interceptors in this stack Iterator



getMembershipService
public MembershipService getMembershipService()(Code)
Returns the membership service component MembershipService



getOptionCheck
public boolean getOptionCheck()(Code)

See Also:   GroupChannel.setOptionCheck(boolean) boolean



heartbeat
public void heartbeat()(Code)
Sends a heartbeat through the interceptor stack.
Invoke this method from the application on a periodic basis if you have turned off internal heartbeats channel.setHeartbeat(false)



memberAdded
public void memberAdded(Member member)(Code)
memberAdded gets invoked by the interceptor below the channel and the channel will broadcast it to the membership listeners
Parameters:
  member - Member - the new member



memberDisappeared
public void memberDisappeared(Member member)(Code)
memberDisappeared gets invoked by the interceptor below the channel and the channel will broadcast it to the membership listeners
Parameters:
  member - Member - the member that left or crashed



messageReceived
public void messageReceived(ChannelMessage msg)(Code)
Callback from the interceptor stack.
When a message is received from a remote node, this method will be invoked by the previous interceptor.
This method can also be used to send a message to other components within the same application, but its an extreme case, and you're probably better off doing that logic between the applications itself.
Parameters:
  msg - ChannelMessage



removeChannelListener
public void removeChannelListener(ChannelListener channelListener)(Code)
Removes a channel listener from the channel.
Channel listeners are uniquely identified using the equals(Object) method
Parameters:
  channelListener - ChannelListener



removeMembershipListener
public void removeMembershipListener(MembershipListener membershipListener)(Code)
Removes a membership listener from the channel.
Membership listeners are uniquely identified using the equals(Object) method
Parameters:
  membershipListener - MembershipListener



send
public UniqueId send(Member[] destination, Serializable msg, int options) throws ChannelException(Code)
Send a message to the destinations specified
Parameters:
  destination - Member[] - destination.length > 1
Parameters:
  msg - Serializable - the message to send
Parameters:
  options - int - sender options, options can trigger guarantee levels and different interceptors toreact to the message see class documentation for the Channel object.
UniqueId - the unique Id that was assigned to this message
throws:
  ChannelException - - if an error occurs processing the message
See Also:   org.apache.catalina.tribes.Channel



send
public UniqueId send(Member[] destination, Serializable msg, int options, ErrorHandler handler) throws ChannelException(Code)

Parameters:
  destination - Member[] - destination.length > 1
Parameters:
  msg - Serializable - the message to send
Parameters:
  options - int - sender options, options can trigger guarantee levels and different interceptors toreact to the message see class documentation for the Channel object.

Parameters:
  handler - - callback object for error handling and completion notification, used when a message issent asynchronously using the Channel.SEND_OPTIONS_ASYNCHRONOUS flag enabled. UniqueId - the unique Id that was assigned to this message
throws:
  ChannelException - - if an error occurs processing the message
See Also:   org.apache.catalina.tribes.Channel



sendNoRpcChannelReply
protected void sendNoRpcChannelReply(RpcMessage msg, Member destination)(Code)
Sends a NoRpcChannelReply message to a member
This method gets invoked by the channel if a RPC message comes in and no channel listener accepts the message. This avoids timeout
Parameters:
  msg - RpcMessage
Parameters:
  destination - Member - the destination for the reply



setChannelReceiver
public void setChannelReceiver(ChannelReceiver clusterReceiver)(Code)
Sets the channel receiver component
Parameters:
  clusterReceiver - ChannelReceiver



setChannelSender
public void setChannelSender(ChannelSender clusterSender)(Code)
Sets the channel sender component
Parameters:
  clusterSender - ChannelSender



setHeartbeat
public void setHeartbeat(boolean heartbeat)(Code)
Enables or disables local heartbeat. if setHeartbeat(true) is invoked then the channel will start an internal thread to invoke Channel.heartbeat() every getHeartbeatSleeptime milliseconds
Parameters:
  heartbeat - boolean



setHeartbeatSleeptime
public void setHeartbeatSleeptime(long heartbeatSleeptime)(Code)
Configure local heartbeat sleep time
Only used when getHeartbeat()==true
Parameters:
  heartbeatSleeptime - long - time in milliseconds to sleep between heartbeats



setMembershipService
public void setMembershipService(MembershipService membershipService)(Code)
Sets the membership component
Parameters:
  membershipService - MembershipService



setOptionCheck
public void setOptionCheck(boolean optionCheck)(Code)
Enables/disables the option check
Setting this to true, will make the GroupChannel perform a conflict check on the interceptors. If two interceptors are using the same option flag and throw an error upon start.
Parameters:
  optionCheck - boolean



setupDefaultStack
protected synchronized void setupDefaultStack() throws ChannelException(Code)
Sets up the default implementation interceptor stack if no interceptors have been added
throws:
  ChannelException -



start
public synchronized void start(int svc) throws ChannelException(Code)
Starts the channel
Parameters:
  svc - int - what service to start
throws:
  ChannelException -
See Also:   org.apache.catalina.tribes.Channel.start(int)



stop
public synchronized void stop(int svc) throws ChannelException(Code)
Stops the channel
Parameters:
  svc - int
throws:
  ChannelException -
See Also:   org.apache.catalina.tribes.Channel.stop(int)



Fields inherited from org.apache.catalina.tribes.group.ChannelInterceptorBase
protected static org.apache.juli.logging.Log log(Code)(Java Doc)
protected int optionFlag(Code)(Java Doc)

Methods inherited from org.apache.catalina.tribes.group.ChannelInterceptorBase
public boolean accept(ChannelMessage msg)(Code)(Java Doc)
public void fireInterceptorEvent(InterceptorEvent event)(Code)(Java Doc)
public Member getLocalMember(boolean incAlive)(Code)(Java Doc)
public Member getMember(Member mbr)(Code)(Java Doc)
public Member[] getMembers()(Code)(Java Doc)
final public ChannelInterceptor getNext()(Code)(Java Doc)
public int getOptionFlag()(Code)(Java Doc)
final public ChannelInterceptor getPrevious()(Code)(Java Doc)
public boolean hasMembers()(Code)(Java Doc)
public void heartbeat()(Code)(Java Doc)
public void memberAdded(Member member)(Code)(Java Doc)
public void memberDisappeared(Member member)(Code)(Java Doc)
public void messageReceived(ChannelMessage msg)(Code)(Java Doc)
public boolean okToProcess(int messageFlags)(Code)(Java Doc)
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException(Code)(Java Doc)
final public void setNext(ChannelInterceptor next)(Code)(Java Doc)
public void setOptionFlag(int optionFlag)(Code)(Java Doc)
final public void setPrevious(ChannelInterceptor previous)(Code)(Java Doc)
public void start(int svc) throws ChannelException(Code)(Java Doc)
public void stop(int svc) throws ChannelException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.