[Jboss-cvs] JBossAS SVN: r56108 - branches/JBoss_4_0_3_SP1_JBAS_3453/connector/src/main/org/jboss/resource/connectionmanager
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 21 11:20:45 EDT 2006
Author: weston.price at jboss.com
Date: 2006-08-21 11:20:43 -0400 (Mon, 21 Aug 2006)
New Revision: 56108
Added:
branches/JBoss_4_0_3_SP1_JBAS_3453/connector/src/main/org/jboss/resource/connectionmanager/PurgePolicy.java
Log:
[JBAS-3453] Adding purge policy and policy handling to JBossManagedConnectionPool
as well as InternalManagedConnectionPool.
Added: branches/JBoss_4_0_3_SP1_JBAS_3453/connector/src/main/org/jboss/resource/connectionmanager/PurgePolicy.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS_3453/connector/src/main/org/jboss/resource/connectionmanager/PurgePolicy.java 2006-08-21 15:20:04 UTC (rev 56107)
+++ branches/JBoss_4_0_3_SP1_JBAS_3453/connector/src/main/org/jboss/resource/connectionmanager/PurgePolicy.java 2006-08-21 15:20:43 UTC (rev 56108)
@@ -0,0 +1,91 @@
+package org.jboss.resource.connectionmanager;
+
+public class PurgePolicy
+{
+ private final int policyType;
+ private static final String POLICY_NONE = "None";
+ private static final String POLICY_CONNECTION = "Connection";
+ private static final String POLICY_POOL = "Pool";
+
+ private PurgePolicy(int policyType)
+ {
+ this.policyType = policyType;
+ }
+
+ public static PurgePolicy NONE = new PurgePolicy(0);
+
+ public static PurgePolicy CONNECTION = new PurgePolicy(1);
+
+ public static PurgePolicy POOL = new PurgePolicy(2);
+
+ public static PurgePolicy getInstance(final String type)
+ {
+ PurgePolicy policy = null;
+
+ if(type.equalsIgnoreCase(POLICY_NONE))
+ {
+ policy = NONE;
+
+ }
+ else if(type.equalsIgnoreCase(POLICY_CONNECTION))
+ {
+ policy = CONNECTION;
+
+ }else if(type.equalsIgnoreCase(POLICY_POOL))
+ {
+ policy = POOL;
+ }
+ else
+ {
+ //TODO throw here
+ }
+
+ return policy;
+ }
+
+ private int getType()
+ {
+ return policyType;
+ }
+ public boolean equals(Object obj)
+ {
+
+ if(this == obj)
+ {
+ return true;
+ }
+
+ if(!(obj instanceof PurgePolicy))
+ {
+ return false;
+ }
+
+ PurgePolicy other = (PurgePolicy)obj;
+
+ return (other.getType() == this.getType());
+
+
+ }
+
+ public String toString()
+ {
+ String current = null;
+
+ switch (policyType) {
+ case 0:
+ current = POLICY_NONE;
+ break;
+ case 1:
+ current = POLICY_CONNECTION;
+ break;
+ case 2:
+ current = POLICY_POOL;
+ break;
+ default:
+ //Should probably throw here, for now, none
+ current = POLICY_NONE;
+ }
+
+ return current;
+ }
+}
More information about the jboss-cvs-commits
mailing list