Source Code Cross Referenced for DiscussionManagerImpl.java in  » J2EE » Enhydra-Demos » chat » business » 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 » J2EE » Enhydra Demos » chat.business 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package chat.business;
002:
003:        import chat.spec.*;
004:
005:        public class DiscussionManagerImpl implements  DiscussionManager {
006:
007:            public DiscussionManagerImpl() {
008:            }
009:
010:            /**
011:             *  Add a message to the discussion. Any waiting clients will be
012:             *  instantly notified.
013:             */
014:            public void addMessage(String name, String txt) {
015:                Discussion.addMessage(name, txt);
016:            }
017:
018:            /**
019:             *  Throw out all the current messages. 
020:             *  All the waiting clients will be immediatly notified.
021:             */
022:            public void clear() {
023:                Discussion.clear();
024:            }
025:
026:            /**
027:             *  Get a snapshot of the current state. Might block.
028:             *
029:             *  @param currentState
030:             *    The state identifier that was returned last time this was called.
031:             *    This is the id of the state that the client currently has. It is
032:             *    asking for a snapshot of the state after things change and
033:             *    this id is not longer current. If this has already happened, the
034:             *    call will immediatly return. If it has not happned, the call will
035:             *    block (not return) until things change.
036:             *  @param wait
037:             *    The maxmimum number of seconds this call is allowed to block for.
038:             *    Send 0 for an instant response. If the call blocks and then
039:             *    runs out of time, a snapshot is returned.
040:             *  @return
041:             *    A Snapshot object. This is just a way to return two things at
042:             *    once: a Vector of Message objects and a state identifier.
043:             *    The client should use the state identifier for the next call to
044:             *    this method. The client should call this method again as soon as
045:             *    it is done displaying the results.
046:             */
047:            public Snapshot getContents(long currentState, long wait) {
048:
049:                return Discussion.getContents(currentState, wait);
050:            }
051:
052:            /**
053:             *  How may clients are blocked on a read? This is, effectivly, the
054:             *  number of people participating in the discussion.
055:             */
056:            public int getNumWaiting() {
057:                return Discussion.getNumWaiting();
058:            }
059:
060:            public long getTotalReceived() {
061:                return Discussion.getTotalReceived();
062:            }
063:
064:            public long getCurrentSize() {
065:                return Discussion.getCurrentSize();
066:            }
067:
068:            public void setMaxQueueSize(int maxQueueSize) {
069:                Discussion.maxQueueSize = maxQueueSize;
070:            }
071:
072:            /**
073:             *  Call this function (only once) if you want to start the
074:             *  harverter thread. It runs in the background and periodically
075:             *  deletes messages that are too old. Most of the time the thread
076:             *  is sleeping. If this method is not called, then no age limit on
077:             *  messages will be enforced. <P>
078:             *
079:             *  The longest a message can live is lifetimeSec + intervalSec seconds
080:             *  (in the extreme case). <P>
081:             *
082:             *  The default value for the interval is a little shorter than the
083:             *  default value for the browser's timeout. This is so that if the
084:             *  browser is left idle (and messages start being deleted), the
085:             *  refresh cycle will sync up with this threads interval, and
086:             *  fewer updates will happen (delete, delete, delete... instead of
087:             *  timout, delete, timeout, delete, timeout, delete...).  It's not
088:             *  a big deal, but hey...
089:             *
090:             *  @param lifetimeSec
091:             *    How long should messages be kept for (seconds).
092:             *  @param 
093:             */
094:            public void startHarvester(int lifetimeSec, int intervalSec) {
095:
096:                Discussion.startHarvester(lifetimeSec, intervalSec);
097:
098:            }
099:
100:            public void stopHarvester() {
101:                Discussion.stopHarvester();
102:            }
103:
104:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.