From: Jules G. <jul...@us...> - 2002-11-17 01:36:15
|
User: jules_gosnell Date: 02/11/16 17:36:15 Modified: jetty/src/main/org/mortbay/j2ee/session Tag: Branch_3_2 JGStore.java Log: increase configurability of JGStore Revision Changes Path No revision No revision 1.1.2.8 +46 -9 contrib/jetty/src/main/org/mortbay/j2ee/session/JGStore.java Index: JGStore.java =================================================================== RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/mortbay/j2ee/session/JGStore.java,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- JGStore.java 16 Nov 2002 21:58:58 -0000 1.1.2.7 +++ JGStore.java 17 Nov 2002 01:36:14 -0000 1.1.2.8 @@ -1,6 +1,6 @@ // ======================================================================== // Copyright (c) 2002 Mort Bay Consulting (Australia) Pty. Ltd. -// $Id: JGStore.java,v 1.1.2.7 2002/11/16 21:58:58 jules_gosnell Exp $ +// $Id: JGStore.java,v 1.1.2.8 2002/11/17 01:36:14 jules_gosnell Exp $ // ======================================================================== package org.mortbay.j2ee.session; @@ -77,20 +77,58 @@ public String getProtocolStack() {return _protocolStack;} public void setProtocolStack(String protocolStack) {_protocolStack=protocolStack;} - protected int _timeOut=500; - public int getTimeOut() {return _timeOut;} - public void setTimeOut(int timeOut) {_timeOut=timeOut;} + protected String _subClusterName="DefaultSubCluster"; + public String getSubClusterName() {return _subClusterName;} + public void setSubClusterName(String subClusterName) {_subClusterName=subClusterName;} + + protected int _retrievalTimeOut=500; + public int getRetrievalTimeOut() {return _retrievalTimeOut;} + public void setRetrievalTimeOut(int retrievalTimeOut) {_retrievalTimeOut=retrievalTimeOut;} + + protected int _distributionModeInternal=GroupRequest.GET_ALL; // synchronous + protected int getDistributionModeInternal() {return _distributionModeInternal;} + protected void + setDistributionModeInternal(String distributionMode) + { + try + { + _distributionModeInternal=GroupRequest.class.getDeclaredField(distributionMode).getInt(GroupRequest.class); + } + catch (Exception e) + { + _log.error("could not convert "+distributionMode+" to GroupRequest field", e); + } + _log.debug("GroupRequest:"+distributionMode+"="+_distributionModeInternal); + } + + protected String _distributionMode="GET_ALL"; + public String getDistributionMode() {return _distributionMode;} + public void + setDistributionMode(String distributionMode) + { + _distributionMode=distributionMode; + setDistributionModeInternal(_distributionMode); + } + + protected int _distributionTimeOut=0; + public int getDistributionTimeOut() {return _distributionTimeOut;} + public void setDistributionTimeOut(int distributionTimeOut) {_distributionTimeOut=distributionTimeOut;} public Object clone() { JGStore jgs=(JGStore)super.clone(); jgs.setProtocolStack(getProtocolStack()); - jgs.setTimeOut(getTimeOut()); + jgs.setSubClusterName(getSubClusterName()); + jgs.setRetrievalTimeOut(getRetrievalTimeOut()); + jgs.setDistributionMode(getDistributionMode()); + jgs.setDistributionTimeOut(getDistributionTimeOut()); return jgs; } + //---------------------------------------- + protected Channel _channel; protected RpcDispatcher _dispatcher; @@ -123,7 +161,7 @@ public String getChannelName() { - return "HTTPSESSION_REPLICATION:"+getContextPath(); + return "JETTY_HTTPSESSION_DISTRIBUTION:"+getContextPath()+"-"+getSubClusterName(); } public void @@ -136,8 +174,7 @@ _channel.connect(getChannelName()); // group should be on a per-context basis _dispatcher.start(); - int timeOut=_timeOut; - if (!_channel.getState(null, timeOut)) + if (!_channel.getState(null, getRetrievalTimeOut())) _log.info("could not retrieve current sessions from JavaGroups"); } @@ -174,7 +211,7 @@ method.addArg(argClasses); method.addArg(argInstances); - _dispatcher.callRemoteMethods(null,method,GroupRequest.GET_ALL,0); // synchronous + _dispatcher.callRemoteMethods(null,method,getDistributionModeInternal(),getDistributionTimeOut()); } catch(Exception e) { |