Source Code Cross Referenced for DistributedHashDeadLock.java in  » Net » JGroups-2.4.1-sp3 » org » jgroups » tests » 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 » Net » JGroups 2.4.1 sp3 » org.jgroups.tests 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package org.jgroups.tests;
02:
03:        import org.jgroups.ChannelException;
04:        import org.jgroups.blocks.DistributedHashtable;
05:        import org.jgroups.util.Util;
06:
07:        /**
08:         * Title:        Java Groups Communications
09:         * Description:  Contact me at <a href="mailto:filip@filip.net">filip@filip.net</a>
10:         * Copyright:    Copyright (c) 2002
11:         * Company:      www.filip.net
12:         * @author Filip Hanik
13:         * @version 1.0
14:         */
15:        public class DistributedHashDeadLock {
16:
17:            public DistributedHashDeadLock() {
18:            }
19:
20:            public static void main(String arg[]) throws ChannelException {
21:                System.out.println("Starting hashtable");
22:                String props = "UDP(mcast_addr=224.0.0.35;mcast_port=45566;ip_ttl=32;mcast_send_buf_size=150000;mcast_recv_buf_size=80000):"
23:                        + "PING(timeout=2000;num_initial_members=3):"
24:                        + "MERGE2:"
25:                        + "FD:"
26:                        + "VERIFY_SUSPECT(timeout=1500):"
27:                        + "pbcast.NAKACK(max_xmit_size=16000;gc_lag=1500;retransmit_timeout=600,1200,2400,4800):"
28:                        + "UNICAST(timeout=2000):"
29:                        + "pbcast.STABLE(desired_avg_gossip=20000):"
30:                        + "FRAG(frag_size=16000;down_thread=false;up_thread=false):"
31:                        + "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=true):"
32:                        + "pbcast.STATE_TRANSFER";
33:
34:                DistributedHashtable distHash = new DistributedHashtable(
35:                        "ADMINT", null, props, 20000);
36:                boolean odd = false;
37:                int numberofelements = 1000;
38:
39:                Util.sleep(5000);
40:                System.out.println("size: " + distHash.size());
41:                if (distHash.size() > 0)//The first instance counts up when numbers are even
42:                { //The  second when numbers are odd
43:                    odd = true;
44:                }
45:                boolean fillup = false;
46:                if (!odd)
47:                    System.out.println("Loading hashtable with "
48:                            + numberofelements
49:                            + " elements. Don't start the other instance");
50:                for (int i = 0; !odd && i < numberofelements; i++)//if the table isn't full we fill it
51:                {
52:                    if (i % 50 == 0)
53:                        System.out.print(i + " ");
54:                    distHash.put("number" + i, new Integer(0));
55:                    fillup = true;
56:                }
57:                if (fillup)
58:                    System.out
59:                            .println("\n\nHashtable filled, you can now start the other instance\n");
60:                System.out.println("initilising with odd: " + odd
61:                        + " and size " + distHash.size());
62:                while (true) {
63:                    try {
64:                        System.out
65:                                .println("#######################################################");
66:                        Thread.sleep(10000);
67:                        int count = 0;
68:                        for (int i = 0; i < numberofelements; i++) {
69:                            int value = ((Integer) distHash.get("number" + i))
70:                                    .intValue();
71:                            System.out.print(value + " ");
72:                            if (i % 50 == 0)
73:                                System.out.print("\n");
74:                            if (odd && (value % 2 != 0))//If the number is odd, and the instance is supposed to count odd numbers up
75:                            {
76:                                count++;
77:                                value++;
78:                                distHash.put("number" + i, new Integer(value));
79:                                continue;
80:                            }
81:                            if (!odd && (value % 2 == 0))//If the number is even, and the instance is supposed to count even numbers up
82:                            {
83:                                count++;
84:                                value++;
85:                                distHash.put("number" + i, new Integer(value));
86:                                continue;
87:                            }
88:                        }
89:                        System.out.println("\n" + odd
90:                                + " through all session, changed: " + count);
91:
92:                    } catch (Exception e) {
93:                        e.printStackTrace();
94:                    }
95:                }
96:
97:            }
98:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.