You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by di...@apache.org on 2007/08/09 02:51:42 UTC
svn commit: r564061 [3/15] - in
/webservices/sandesha/branches/sandesha2/java/1_3: ./ modules/client/
modules/core/ modules/core/src/main/java/org/apache/sandesha2/
modules/core/src/main/java/org/apache/sandesha2/client/
modules/core/src/main/java/org/...
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSequenceBean.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSequenceBean.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSequenceBean.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSequenceBean.java Wed Aug 8 17:51:29 2007
@@ -1,266 +1,266 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.sandesha2.storage.beans;
-
-/**
- * This bean is used at the receiving side (of both server and client)
- * There is one entry for each sequence.
- */
-
-public class RMSequenceBean extends RMBean {
-
- private static final long serialVersionUID = 1335488724679432728L;
- /**
- * Comment for <code>sequenceID</code>
- * The sequenceID of the representing sequence.
- */
- private String sequenceID;
-
- private String toEPR;
-
- private String replyToEPR;
-
- private String acksToEPR;
-
- private String RMVersion;
-
- /**
- * Comment for <code>securityTokenData</code>
- * This is the security token data needed to reconstruct the token that secures this sequence.
- */
- private String securityTokenData;
-
- private long lastActivatedTime;
-
- /**
- * Indicates that a sequence is closed
- */
- private boolean closed = false;
-
- /**
- * Indicates that a sequence is terminated
- */
- private boolean terminated = false;
-
- /**
- * This tells weather this sequence is in the polling mode or not.
- * PollingManager will use this property decide the sequences that need
- * polling and will do MakeConnections on them.
- */
- private boolean pollingMode=false;
-
- private String serviceName = null;
-
- /**
- * Flags that are used to check if the primitive types on this bean
- * have been set. If a primitive type has not been set then it will
- * be ignored within the match method.
- */
- private int flags = 0;
- private static final int LAST_ACTIVATED_TIME_FLAG = 0x00000001;
- private static final int CLOSED_FLAG = 0x00000010;
- private static final int TERMINATED_FLAG = 0x00000100;
- private static final int POLLING_MODE_FLAG = 0x00001000;
-
- public RMSequenceBean() {
-
- }
-
- /**
- * Constructor that copies all RMSBean values from the RMSBean supplied
- * @param beanToCopy
- */
- public RMSequenceBean(RMSequenceBean beanToCopy) {
- acksToEPR = beanToCopy.getAcksToEPR();
- closed = beanToCopy.isClosed();
- lastActivatedTime = beanToCopy.getLastActivatedTime();
- pollingMode = beanToCopy.isPollingMode();
- replyToEPR = beanToCopy.getReplyToEPR();
- RMVersion = beanToCopy.getRMVersion();
- securityTokenData = beanToCopy.getSecurityTokenData();
- sequenceID = beanToCopy.getSequenceID();
- terminated = beanToCopy.isTerminated();
- toEPR = beanToCopy.getToEPR();
- serviceName = beanToCopy.getServiceName();
- }
-
- public RMSequenceBean(String sequenceID) {
- this.setSequenceID(sequenceID);
- }
-
- /**
- * @return Returns the sequenceId.
- */
- public String getSequenceID() {
- return sequenceID;
- }
-
- /**
- * @param sequenceId
- * The sequenceId to set.
- */
- public void setSequenceID(String sequenceID) {
- this.sequenceID = sequenceID;
- }
-
- public String getAcksToEPR() {
- return acksToEPR;
- }
-
- public void setAcksToEPR(String acksToEPR) {
- this.acksToEPR = acksToEPR;
- }
-
- public String getReplyToEPR() {
- return replyToEPR;
- }
-
- public void setReplyToEPR(String replyToEPR) {
- this.replyToEPR = replyToEPR;
- }
-
- public String getToEPR() {
- return toEPR;
- }
-
- public void setToEPR(String toEPR) {
- this.toEPR = toEPR;
- }
-
- public boolean isPollingMode() {
- return pollingMode;
- }
-
- public void setPollingMode(boolean pollingMode) {
- this.pollingMode = pollingMode;
- this.flags |= POLLING_MODE_FLAG;
- }
-
- public boolean isClosed() {
- return closed;
- }
-
- public void setClosed(boolean closed) {
- this.closed = closed;
- this.flags |= CLOSED_FLAG;
- }
-
- public boolean isTerminated() {
- return terminated;
- }
-
- public void setTerminated(boolean terminated) {
- this.terminated = terminated;
- this.flags |= TERMINATED_FLAG;
- }
-
- public long getLastActivatedTime() {
- return lastActivatedTime;
- }
-
- public void setLastActivatedTime(long lastActivatedTime) {
- this.lastActivatedTime = lastActivatedTime;
- this.flags |= LAST_ACTIVATED_TIME_FLAG;
- }
-
- public String getRMVersion() {
- return RMVersion;
- }
-
- public void setRMVersion(String version) {
- RMVersion = version;
- }
-
- public String getSecurityTokenData() {
- return securityTokenData;
- }
-
- public void setSecurityTokenData(String securityTokenData) {
- this.securityTokenData = securityTokenData;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public int getFlags() {
- return flags;
- }
-
- public void setFlags(int flags) {
- this.flags = flags;
- }
-
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append("\nSequence Id : "); result.append(sequenceID);
- result.append("\ntoEPR : "); result.append(toEPR);
- result.append("\nreplyToEPR : "); result.append(replyToEPR);
- result.append("\nacksToEPR : "); result.append(acksToEPR);
- result.append("\nPolling : "); result.append(pollingMode);
- result.append("\nClosed : "); result.append(closed);
- result.append("\nTerminated : "); result.append(terminated);
- result.append("\nLastActivatedTime: "); result.append(lastActivatedTime);
- result.append("\nRMVersion : "); result.append(RMVersion);
- result.append("\nServiceName : "); result.append(serviceName);
- result.append("\nHas SecurityToken: "); result.append(securityTokenData != null && securityTokenData.length() > 0);
- return result.toString();
- }
-
- public boolean match(RMBean matchInfo) {
- RMSequenceBean bean = (RMSequenceBean) matchInfo;
- boolean match = true;
-
- if(bean.getSequenceID() != null && !bean.getSequenceID().equals(this.getSequenceID()))
- match = false;
-
- else if(bean.getToEPR() != null && !bean.getToEPR().equals(this.getToEPR()))
- match = false;
-
- else if(bean.getReplyToEPR() != null && !bean.getReplyToEPR().equals(this.getReplyToEPR()))
- match = false;
-
- else if(bean.getAcksToEPR() != null && !bean.getAcksToEPR().equals(this.getAcksToEPR()))
- match = false;
-
- else if(bean.getRMVersion() != null && !bean.getRMVersion().equals(this.getRMVersion()))
- match = false;
-
- else if(bean.getSecurityTokenData() != null && !bean.getSecurityTokenData().equals(this.getSecurityTokenData()))
- match = false;
-
-// Avoid matching on the last active time
-// else if((bean.flags & LAST_ACTIVATED_TIME_FLAG) != 0 && bean.getLastActivatedTime() != this.getLastActivatedTime())
-// match = false;
-
- else if((bean.flags & CLOSED_FLAG) != 0 && bean.isClosed() != this.isClosed())
- match = false;
-
- else if((bean.flags & TERMINATED_FLAG) != 0 && bean.isTerminated() != this.isTerminated())
- match = false;
-
- else if((bean.flags & POLLING_MODE_FLAG) != 0 && bean.isPollingMode() != this.isPollingMode())
- match = false;
-
- return match;
- }
-}
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.storage.beans;
+
+/**
+ * This bean is used at the receiving side (of both server and client)
+ * There is one entry for each sequence.
+ */
+
+public class RMSequenceBean extends RMBean {
+
+ private static final long serialVersionUID = 1335488724679432728L;
+ /**
+ * Comment for <code>sequenceID</code>
+ * The sequenceID of the representing sequence.
+ */
+ private String sequenceID;
+
+ private String toEPR;
+
+ private String replyToEPR;
+
+ private String acksToEPR;
+
+ private String RMVersion;
+
+ /**
+ * Comment for <code>securityTokenData</code>
+ * This is the security token data needed to reconstruct the token that secures this sequence.
+ */
+ private String securityTokenData;
+
+ private long lastActivatedTime;
+
+ /**
+ * Indicates that a sequence is closed
+ */
+ private boolean closed = false;
+
+ /**
+ * Indicates that a sequence is terminated
+ */
+ private boolean terminated = false;
+
+ /**
+ * This tells weather this sequence is in the polling mode or not.
+ * PollingManager will use this property decide the sequences that need
+ * polling and will do MakeConnections on them.
+ */
+ private boolean pollingMode=false;
+
+ private String serviceName = null;
+
+ /**
+ * Flags that are used to check if the primitive types on this bean
+ * have been set. If a primitive type has not been set then it will
+ * be ignored within the match method.
+ */
+ private int flags = 0;
+ private static final int LAST_ACTIVATED_TIME_FLAG = 0x00000001;
+ private static final int CLOSED_FLAG = 0x00000010;
+ private static final int TERMINATED_FLAG = 0x00000100;
+ private static final int POLLING_MODE_FLAG = 0x00001000;
+
+ public RMSequenceBean() {
+
+ }
+
+ /**
+ * Constructor that copies all RMSBean values from the RMSBean supplied
+ * @param beanToCopy
+ */
+ public RMSequenceBean(RMSequenceBean beanToCopy) {
+ acksToEPR = beanToCopy.getAcksToEPR();
+ closed = beanToCopy.isClosed();
+ lastActivatedTime = beanToCopy.getLastActivatedTime();
+ pollingMode = beanToCopy.isPollingMode();
+ replyToEPR = beanToCopy.getReplyToEPR();
+ RMVersion = beanToCopy.getRMVersion();
+ securityTokenData = beanToCopy.getSecurityTokenData();
+ sequenceID = beanToCopy.getSequenceID();
+ terminated = beanToCopy.isTerminated();
+ toEPR = beanToCopy.getToEPR();
+ serviceName = beanToCopy.getServiceName();
+ }
+
+ public RMSequenceBean(String sequenceID) {
+ this.setSequenceID(sequenceID);
+ }
+
+ /**
+ * @return Returns the sequenceId.
+ */
+ public String getSequenceID() {
+ return sequenceID;
+ }
+
+ /**
+ * @param sequenceId
+ * The sequenceId to set.
+ */
+ public void setSequenceID(String sequenceID) {
+ this.sequenceID = sequenceID;
+ }
+
+ public String getAcksToEPR() {
+ return acksToEPR;
+ }
+
+ public void setAcksToEPR(String acksToEPR) {
+ this.acksToEPR = acksToEPR;
+ }
+
+ public String getReplyToEPR() {
+ return replyToEPR;
+ }
+
+ public void setReplyToEPR(String replyToEPR) {
+ this.replyToEPR = replyToEPR;
+ }
+
+ public String getToEPR() {
+ return toEPR;
+ }
+
+ public void setToEPR(String toEPR) {
+ this.toEPR = toEPR;
+ }
+
+ public boolean isPollingMode() {
+ return pollingMode;
+ }
+
+ public void setPollingMode(boolean pollingMode) {
+ this.pollingMode = pollingMode;
+ this.flags |= POLLING_MODE_FLAG;
+ }
+
+ public boolean isClosed() {
+ return closed;
+ }
+
+ public void setClosed(boolean closed) {
+ this.closed = closed;
+ this.flags |= CLOSED_FLAG;
+ }
+
+ public boolean isTerminated() {
+ return terminated;
+ }
+
+ public void setTerminated(boolean terminated) {
+ this.terminated = terminated;
+ this.flags |= TERMINATED_FLAG;
+ }
+
+ public long getLastActivatedTime() {
+ return lastActivatedTime;
+ }
+
+ public void setLastActivatedTime(long lastActivatedTime) {
+ this.lastActivatedTime = lastActivatedTime;
+ this.flags |= LAST_ACTIVATED_TIME_FLAG;
+ }
+
+ public String getRMVersion() {
+ return RMVersion;
+ }
+
+ public void setRMVersion(String version) {
+ RMVersion = version;
+ }
+
+ public String getSecurityTokenData() {
+ return securityTokenData;
+ }
+
+ public void setSecurityTokenData(String securityTokenData) {
+ this.securityTokenData = securityTokenData;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public int getFlags() {
+ return flags;
+ }
+
+ public void setFlags(int flags) {
+ this.flags = flags;
+ }
+
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ result.append("\nSequence Id : "); result.append(sequenceID);
+ result.append("\ntoEPR : "); result.append(toEPR);
+ result.append("\nreplyToEPR : "); result.append(replyToEPR);
+ result.append("\nacksToEPR : "); result.append(acksToEPR);
+ result.append("\nPolling : "); result.append(pollingMode);
+ result.append("\nClosed : "); result.append(closed);
+ result.append("\nTerminated : "); result.append(terminated);
+ result.append("\nLastActivatedTime: "); result.append(lastActivatedTime);
+ result.append("\nRMVersion : "); result.append(RMVersion);
+ result.append("\nServiceName : "); result.append(serviceName);
+ result.append("\nHas SecurityToken: "); result.append(securityTokenData != null && securityTokenData.length() > 0);
+ return result.toString();
+ }
+
+ public boolean match(RMBean matchInfo) {
+ RMSequenceBean bean = (RMSequenceBean) matchInfo;
+ boolean match = true;
+
+ if(bean.getSequenceID() != null && !bean.getSequenceID().equals(this.getSequenceID()))
+ match = false;
+
+ else if(bean.getToEPR() != null && !bean.getToEPR().equals(this.getToEPR()))
+ match = false;
+
+ else if(bean.getReplyToEPR() != null && !bean.getReplyToEPR().equals(this.getReplyToEPR()))
+ match = false;
+
+ else if(bean.getAcksToEPR() != null && !bean.getAcksToEPR().equals(this.getAcksToEPR()))
+ match = false;
+
+ else if(bean.getRMVersion() != null && !bean.getRMVersion().equals(this.getRMVersion()))
+ match = false;
+
+ else if(bean.getSecurityTokenData() != null && !bean.getSecurityTokenData().equals(this.getSecurityTokenData()))
+ match = false;
+
+// Avoid matching on the last active time
+// else if((bean.flags & LAST_ACTIVATED_TIME_FLAG) != 0 && bean.getLastActivatedTime() != this.getLastActivatedTime())
+// match = false;
+
+ else if((bean.flags & CLOSED_FLAG) != 0 && bean.isClosed() != this.isClosed())
+ match = false;
+
+ else if((bean.flags & TERMINATED_FLAG) != 0 && bean.isTerminated() != this.isTerminated())
+ match = false;
+
+ else if((bean.flags & POLLING_MODE_FLAG) != 0 && bean.isPollingMode() != this.isPollingMode())
+ match = false;
+
+ return match;
+ }
+}
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/beans/RMSequenceBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/beans/SenderBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryBeanMgr.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java Wed Aug 8 17:51:29 2007
@@ -1,63 +1,63 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.sandesha2.storage.inmemory;
-
-import java.util.List;
-
-import org.apache.axis2.context.AbstractContext;
-import org.apache.sandesha2.Sandesha2Constants;
-import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.storage.SandeshaStorageException;
-import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
-import org.apache.sandesha2.storage.beans.InvokerBean;
-
-public class InMemoryInvokerBeanMgr extends InMemoryBeanMgr implements InvokerBeanMgr {
-
- public InMemoryInvokerBeanMgr(InMemoryStorageManager mgr, AbstractContext context) {
- super(mgr, context, Sandesha2Constants.BeanMAPs.STORAGE_MAP);
- }
-
- public boolean insert(InvokerBean bean) throws SandeshaStorageException {
- boolean result = super.insert(bean.getMessageContextRefKey(), bean);
- mgr.getInMemoryTransaction().setReceivedMessages(true);
- return result;
- }
-
- public boolean delete(String key) throws SandeshaStorageException {
- return super.delete(key);
- }
-
- public InvokerBean retrieve(String key) throws SandeshaStorageException {
- return (InvokerBean) super.retrieve(key);
- }
-
- public List find(InvokerBean bean) throws SandeshaStorageException {
- return super.find(bean);
- }
-
- public boolean update(InvokerBean bean) throws SandeshaStorageException {
- boolean result = super.update(bean.getMessageContextRefKey(), bean);
- mgr.getInMemoryTransaction().setReceivedMessages(true);
- return result;
- }
-
- public InvokerBean findUnique(InvokerBean bean) throws SandeshaException {
- return (InvokerBean) super.findUnique(bean);
- }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.storage.inmemory;
+
+import java.util.List;
+
+import org.apache.axis2.context.AbstractContext;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
+import org.apache.sandesha2.storage.beans.InvokerBean;
+
+public class InMemoryInvokerBeanMgr extends InMemoryBeanMgr implements InvokerBeanMgr {
+
+ public InMemoryInvokerBeanMgr(InMemoryStorageManager mgr, AbstractContext context) {
+ super(mgr, context, Sandesha2Constants.BeanMAPs.STORAGE_MAP);
+ }
+
+ public boolean insert(InvokerBean bean) throws SandeshaStorageException {
+ boolean result = super.insert(bean.getMessageContextRefKey(), bean);
+ mgr.getInMemoryTransaction().setReceivedMessages(true);
+ return result;
+ }
+
+ public boolean delete(String key) throws SandeshaStorageException {
+ return super.delete(key);
+ }
+
+ public InvokerBean retrieve(String key) throws SandeshaStorageException {
+ return (InvokerBean) super.retrieve(key);
+ }
+
+ public List find(InvokerBean bean) throws SandeshaStorageException {
+ return super.find(bean);
+ }
+
+ public boolean update(InvokerBean bean) throws SandeshaStorageException {
+ boolean result = super.update(bean.getMessageContextRefKey(), bean);
+ mgr.getInMemoryTransaction().setReceivedMessages(true);
+ return result;
+ }
+
+ public InvokerBean findUnique(InvokerBean bean) throws SandeshaException {
+ return (InvokerBean) super.findUnique(bean);
+ }
+
+}
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryRMDBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryRMDBeanMgr.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryRMDBeanMgr.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryRMDBeanMgr.java Wed Aug 8 17:51:29 2007
@@ -1,63 +1,63 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.sandesha2.storage.inmemory;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.axis2.context.AbstractContext;
-import org.apache.sandesha2.Sandesha2Constants;
-import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.storage.SandeshaStorageException;
-import org.apache.sandesha2.storage.beanmanagers.RMDBeanMgr;
-import org.apache.sandesha2.storage.beans.RMDBean;
-
-public class InMemoryRMDBeanMgr extends InMemoryBeanMgr implements RMDBeanMgr {
-
- public InMemoryRMDBeanMgr(InMemoryStorageManager mgr, AbstractContext context) {
- super(mgr, context, Sandesha2Constants.BeanMAPs.NEXT_MESSAGE);
- }
-
- public boolean delete(String sequenceId) throws SandeshaStorageException {
- return super.delete(sequenceId);
- }
-
- public RMDBean retrieve(String sequenceId) throws SandeshaStorageException {
- return (RMDBean) super.retrieve(sequenceId);
- }
-
- public boolean insert(RMDBean bean) throws SandeshaStorageException {
- return super.insert(bean.getSequenceID(), bean);
- }
-
- public List find(RMDBean bean) throws SandeshaStorageException {
- return super.find(bean);
- }
-
- public boolean update(RMDBean bean) throws SandeshaStorageException {
- return super.update(bean.getSequenceID(), bean);
- }
-
- public Collection retrieveAll() throws SandeshaStorageException {
- return super.find(null);
- }
-
- public RMDBean findUnique(RMDBean bean) throws SandeshaException {
- return (RMDBean) super.findUnique(bean);
- }
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.storage.inmemory;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.axis2.context.AbstractContext;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beanmanagers.RMDBeanMgr;
+import org.apache.sandesha2.storage.beans.RMDBean;
+
+public class InMemoryRMDBeanMgr extends InMemoryBeanMgr implements RMDBeanMgr {
+
+ public InMemoryRMDBeanMgr(InMemoryStorageManager mgr, AbstractContext context) {
+ super(mgr, context, Sandesha2Constants.BeanMAPs.NEXT_MESSAGE);
+ }
+
+ public boolean delete(String sequenceId) throws SandeshaStorageException {
+ return super.delete(sequenceId);
+ }
+
+ public RMDBean retrieve(String sequenceId) throws SandeshaStorageException {
+ return (RMDBean) super.retrieve(sequenceId);
+ }
+
+ public boolean insert(RMDBean bean) throws SandeshaStorageException {
+ return super.insert(bean.getSequenceID(), bean);
+ }
+
+ public List find(RMDBean bean) throws SandeshaStorageException {
+ return super.find(bean);
+ }
+
+ public boolean update(RMDBean bean) throws SandeshaStorageException {
+ return super.update(bean.getSequenceID(), bean);
+ }
+
+ public Collection retrieveAll() throws SandeshaStorageException {
+ return super.find(null);
+ }
+
+ public RMDBean findUnique(RMDBean bean) throws SandeshaException {
+ return (RMDBean) super.findUnique(bean);
+ }
+}
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryRMDBeanMgr.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryRMSBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryRMSBeanMgr.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryRMSBeanMgr.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryRMSBeanMgr.java Wed Aug 8 17:51:29 2007
@@ -1,59 +1,59 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.sandesha2.storage.inmemory;
-
-import java.util.List;
-
-import org.apache.axis2.context.AbstractContext;
-import org.apache.sandesha2.Sandesha2Constants;
-import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.storage.SandeshaStorageException;
-import org.apache.sandesha2.storage.beanmanagers.RMSBeanMgr;
-import org.apache.sandesha2.storage.beans.RMSBean;
-
-public class InMemoryRMSBeanMgr extends InMemoryBeanMgr implements RMSBeanMgr {
-
- public InMemoryRMSBeanMgr(InMemoryStorageManager mgr, AbstractContext context) {
- super(mgr, context, Sandesha2Constants.BeanMAPs.CREATE_SEQUECE);
- }
-
- public boolean insert(RMSBean bean) throws SandeshaStorageException {
- return super.insert(bean.getCreateSeqMsgID(), bean);
- }
-
- public boolean delete(String msgId) throws SandeshaStorageException {
- return super.delete(msgId);
- }
-
- public RMSBean retrieve(String msgId) throws SandeshaStorageException {
- return (RMSBean) super.retrieve(msgId);
- }
-
- public boolean update(RMSBean bean) throws SandeshaStorageException {
- return super.update(bean.getCreateSeqMsgID(), bean);
- }
-
- public List find(RMSBean bean) throws SandeshaStorageException {
- return super.find(bean);
- }
-
- public RMSBean findUnique (RMSBean bean) throws SandeshaException {
- return (RMSBean) super.findUnique(bean);
- }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.storage.inmemory;
+
+import java.util.List;
+
+import org.apache.axis2.context.AbstractContext;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beanmanagers.RMSBeanMgr;
+import org.apache.sandesha2.storage.beans.RMSBean;
+
+public class InMemoryRMSBeanMgr extends InMemoryBeanMgr implements RMSBeanMgr {
+
+ public InMemoryRMSBeanMgr(InMemoryStorageManager mgr, AbstractContext context) {
+ super(mgr, context, Sandesha2Constants.BeanMAPs.CREATE_SEQUECE);
+ }
+
+ public boolean insert(RMSBean bean) throws SandeshaStorageException {
+ return super.insert(bean.getCreateSeqMsgID(), bean);
+ }
+
+ public boolean delete(String msgId) throws SandeshaStorageException {
+ return super.delete(msgId);
+ }
+
+ public RMSBean retrieve(String msgId) throws SandeshaStorageException {
+ return (RMSBean) super.retrieve(msgId);
+ }
+
+ public boolean update(RMSBean bean) throws SandeshaStorageException {
+ return super.update(bean.getCreateSeqMsgID(), bean);
+ }
+
+ public List find(RMSBean bean) throws SandeshaStorageException {
+ return super.find(bean);
+ }
+
+ public RMSBean findUnique (RMSBean bean) throws SandeshaException {
+ return (RMSBean) super.findUnique(bean);
+ }
+
+}
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryRMSBeanMgr.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java Wed Aug 8 17:51:29 2007
@@ -1,124 +1,124 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.sandesha2.storage.inmemory;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.axis2.context.AbstractContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sandesha2.Sandesha2Constants;
-import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.i18n.SandeshaMessageHelper;
-import org.apache.sandesha2.i18n.SandeshaMessageKeys;
-import org.apache.sandesha2.storage.SandeshaStorageException;
-import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
-import org.apache.sandesha2.storage.beans.SenderBean;
-
-public class InMemorySenderBeanMgr extends InMemoryBeanMgr implements SenderBeanMgr {
-
- private static final Log log = LogFactory.getLog(InMemorySenderBeanMgr.class);
-
- public InMemorySenderBeanMgr(InMemoryStorageManager mgr, AbstractContext context) {
- super(mgr, context, Sandesha2Constants.BeanMAPs.RETRANSMITTER);
- }
-
- public boolean delete(String MessageId) throws SandeshaStorageException {
- return super.delete(MessageId);
- }
-
- public SenderBean retrieve(String MessageId) throws SandeshaStorageException {
- return (SenderBean) super.retrieve(MessageId);
- }
-
- public boolean insert(SenderBean bean) throws SandeshaStorageException {
- if (bean.getMessageID() == null)
- throw new SandeshaStorageException(SandeshaMessageHelper.getMessage(
- SandeshaMessageKeys.nullMsgId));
- boolean result = super.insert(bean.getMessageID(), bean);
- mgr.getInMemoryTransaction().setSentMessages(true);
- return result;
- }
-
- public List find(String internalSequenceID) throws SandeshaStorageException {
- SenderBean temp = new SenderBean();
- temp.setInternalSequenceID(internalSequenceID);
- return super.find(temp);
- }
-
- public List find(SenderBean bean) throws SandeshaStorageException {
- return super.find(bean);
- }
-
- public SenderBean getNextMsgToSend(String sequenceId) throws SandeshaStorageException {
- if(log.isDebugEnabled()) log.debug("Entry: InMemorySenderBeanManager::getNextMessageToSend " + sequenceId);
-
- // Set up match criteria
- SenderBean matcher = new SenderBean();
- matcher.setSend(true);
- matcher.setSequenceID(sequenceId);
- matcher.setTimeToSend(System.currentTimeMillis());
- matcher.setTransportAvailable(true);
-
- List matches = super.find(matcher);
- if(log.isDebugEnabled()) log.debug("Found " + matches.size() + " messages");
-
- // Look for the message with the lowest send time, and send that one.
- SenderBean result = null;
- Iterator i = matches.iterator();
- while(i.hasNext()) {
- SenderBean bean = (SenderBean) i.next();
- if (bean.getTimeToSend()<0)
- continue; //Beans with negative timeToSend values are not considered as candidates for sending.
-
- if (bean.getSentCount() > 0 && !bean.isReSend())
- continue; //Avoid re-sending messages that we should not resend
-
- // Check that the Send time has not been updated under another thread
- if (!bean.match(matcher))
- continue;
-
- if(result == null) {
- result = bean;
- } else if(result.getTimeToSend() > bean.getTimeToSend()) {
- result = bean;
- }
- }
-
- if(log.isDebugEnabled()) log.debug("Exit: InMemorySenderBeanManager::getNextMessageToSend " + result);
- return result;
- }
-
- public boolean update(SenderBean bean) throws SandeshaStorageException {
- boolean result = super.update(bean.getMessageID(), bean);
- mgr.getInMemoryTransaction().setSentMessages(true);
- return result;
- }
-
- public SenderBean findUnique(SenderBean bean) throws SandeshaException {
- return (SenderBean) super.findUnique(bean);
- }
-
- public SenderBean retrieveFromMessageRefKey(String messageContextRefKey) {
- throw new UnsupportedOperationException("Deprecated method");
- }
-
-
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.sandesha2.storage.inmemory;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.axis2.context.AbstractContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
+import org.apache.sandesha2.storage.beans.SenderBean;
+
+public class InMemorySenderBeanMgr extends InMemoryBeanMgr implements SenderBeanMgr {
+
+ private static final Log log = LogFactory.getLog(InMemorySenderBeanMgr.class);
+
+ public InMemorySenderBeanMgr(InMemoryStorageManager mgr, AbstractContext context) {
+ super(mgr, context, Sandesha2Constants.BeanMAPs.RETRANSMITTER);
+ }
+
+ public boolean delete(String MessageId) throws SandeshaStorageException {
+ return super.delete(MessageId);
+ }
+
+ public SenderBean retrieve(String MessageId) throws SandeshaStorageException {
+ return (SenderBean) super.retrieve(MessageId);
+ }
+
+ public boolean insert(SenderBean bean) throws SandeshaStorageException {
+ if (bean.getMessageID() == null)
+ throw new SandeshaStorageException(SandeshaMessageHelper.getMessage(
+ SandeshaMessageKeys.nullMsgId));
+ boolean result = super.insert(bean.getMessageID(), bean);
+ mgr.getInMemoryTransaction().setSentMessages(true);
+ return result;
+ }
+
+ public List find(String internalSequenceID) throws SandeshaStorageException {
+ SenderBean temp = new SenderBean();
+ temp.setInternalSequenceID(internalSequenceID);
+ return super.find(temp);
+ }
+
+ public List find(SenderBean bean) throws SandeshaStorageException {
+ return super.find(bean);
+ }
+
+ public SenderBean getNextMsgToSend(String sequenceId) throws SandeshaStorageException {
+ if(log.isDebugEnabled()) log.debug("Entry: InMemorySenderBeanManager::getNextMessageToSend " + sequenceId);
+
+ // Set up match criteria
+ SenderBean matcher = new SenderBean();
+ matcher.setSend(true);
+ matcher.setSequenceID(sequenceId);
+ matcher.setTimeToSend(System.currentTimeMillis());
+ matcher.setTransportAvailable(true);
+
+ List matches = super.find(matcher);
+ if(log.isDebugEnabled()) log.debug("Found " + matches.size() + " messages");
+
+ // Look for the message with the lowest send time, and send that one.
+ SenderBean result = null;
+ Iterator i = matches.iterator();
+ while(i.hasNext()) {
+ SenderBean bean = (SenderBean) i.next();
+ if (bean.getTimeToSend()<0)
+ continue; //Beans with negative timeToSend values are not considered as candidates for sending.
+
+ if (bean.getSentCount() > 0 && !bean.isReSend())
+ continue; //Avoid re-sending messages that we should not resend
+
+ // Check that the Send time has not been updated under another thread
+ if (!bean.match(matcher))
+ continue;
+
+ if(result == null) {
+ result = bean;
+ } else if(result.getTimeToSend() > bean.getTimeToSend()) {
+ result = bean;
+ }
+ }
+
+ if(log.isDebugEnabled()) log.debug("Exit: InMemorySenderBeanManager::getNextMessageToSend " + result);
+ return result;
+ }
+
+ public boolean update(SenderBean bean) throws SandeshaStorageException {
+ boolean result = super.update(bean.getMessageID(), bean);
+ mgr.getInMemoryTransaction().setSentMessages(true);
+ return result;
+ }
+
+ public SenderBean findUnique(SenderBean bean) throws SandeshaException {
+ return (SenderBean) super.findUnique(bean);
+ }
+
+ public SenderBean retrieveFromMessageRefKey(String messageContextRefKey) {
+ throw new UnsupportedOperationException("Deprecated method");
+ }
+
+
+
+}
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemorySenderBeanMgr.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java Wed Aug 8 17:51:29 2007
@@ -1,364 +1,364 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- *
- */
-
-package org.apache.sandesha2.storage.inmemory;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.Collection;
-import java.util.HashMap;
-
-import org.apache.axis2.Constants;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.transport.RequestResponseTransport;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sandesha2.SandeshaException;
-import org.apache.sandesha2.i18n.SandeshaMessageHelper;
-import org.apache.sandesha2.i18n.SandeshaMessageKeys;
-import org.apache.sandesha2.policy.SandeshaPolicyBean;
-import org.apache.sandesha2.polling.PollingManager;
-import org.apache.sandesha2.storage.SandeshaStorageException;
-import org.apache.sandesha2.storage.StorageManager;
-import org.apache.sandesha2.storage.Transaction;
-import org.apache.sandesha2.storage.beanmanagers.RMSBeanMgr;
-import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
-import org.apache.sandesha2.storage.beanmanagers.RMDBeanMgr;
-import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
-import org.apache.sandesha2.storage.beans.RMBean;
-import org.apache.sandesha2.util.SandeshaUtil;
-import org.apache.sandesha2.workers.Invoker;
-import org.apache.sandesha2.workers.SandeshaThread;
-import org.apache.sandesha2.workers.Sender;
-
-public class InMemoryStorageManager extends StorageManager {
-
- private static Log log = LogFactory.getLog(InMemoryStorageManager.class);
-
- private static InMemoryStorageManager instance = null;
- private RMSBeanMgr rMSBeanMgr = null;
- private RMDBeanMgr rMDBeanMgr = null;
- private SenderBeanMgr senderBeanMgr = null;
- private InvokerBeanMgr invokerBeanMgr = null;
- private Sender sender = null;
- private Invoker invoker = null;
- private PollingManager pollingManager = null;
- private HashMap transactions = new HashMap();
- private boolean useSerialization = false;
- private HashMap storageMap = new HashMap();
-
- public InMemoryStorageManager(ConfigurationContext context)
- throws SandeshaException
- {
- super(context);
-
- SandeshaPolicyBean policy = SandeshaUtil.getPropertyBean(context.getAxisConfiguration());
- useSerialization = policy.isUseMessageSerialization();
-
- // Note that while inOrder is a global property we can decide if we need the
- // invoker thread at this point. If we change this to be a sequence-level
- // property then we'll need to revisit this.
- boolean inOrder = policy.isInOrder();
- boolean polling = policy.isEnableMakeConnection();
-
- this.rMSBeanMgr = new InMemoryRMSBeanMgr (this, context);
- this.rMDBeanMgr = new InMemoryRMDBeanMgr (this, context);
- this.senderBeanMgr = new InMemorySenderBeanMgr (this, context);
- this.invokerBeanMgr = new InMemoryInvokerBeanMgr (this, context);
- this.sender = new Sender();
- if(inOrder) this.invoker = new Invoker();
- if(polling) this.pollingManager = new PollingManager();
- }
-
- public Transaction getTransaction() {
- // Calling getTransaction is the only way to set up a new transaction. If you
- // do some work that requires a tran without there being a transaction in scope
- // then the enlist method will throw an exception.
- Transaction result = null;
- synchronized (transactions) {
- Thread key = Thread.currentThread();
- String name = key.getName();
- int id = System.identityHashCode(key);
- result = (Transaction) transactions.get(key);
- if(result == null) {
- result = new InMemoryTransaction(this, name, id);
- transactions.put(key, result);
- } else {
- // We don't want to return an existing transaction, as someone else should
- // decide if we commit it or not. If we get here then we probably have a
- // bug.
- if(log.isDebugEnabled()) log.debug("Possible re-used transaction: " + result);
- result = null;
- }
- }
- return result;
- }
-
- InMemoryTransaction getInMemoryTransaction() {
- InMemoryTransaction result = null;
- synchronized (transactions) {
- Thread key = Thread.currentThread();
- result = (InMemoryTransaction) transactions.get(key);
- }
- return result;
- }
-
- void removeTransaction(Transaction t) {
- synchronized (transactions) {
- Collection entries = transactions.values();
- entries.remove(t);
- }
- }
-
- /**
- * Gets the Invoker for this Storage manager
- */
- public SandeshaThread getInvoker() {
- return invoker;
- }
-
- /**
- * Gets the Sender for this Storage manager
- */
- public SandeshaThread getSender() {
- return sender;
- }
-
- /**
- * Gets the PollingManager for this Storage manager
- */
- public PollingManager getPollingManager() {
- return pollingManager;
- }
-
- void enlistBean(RMBean bean) throws SandeshaStorageException {
- InMemoryTransaction t = null;
- synchronized (transactions) {
- Thread key = Thread.currentThread();
- t = (InMemoryTransaction) transactions.get(key);
- if(t == null) {
- // We attempted to do some work without a transaction in scope
- String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noTransaction);
- SandeshaStorageException e = new SandeshaStorageException(message);
- if(log.isDebugEnabled()) log.debug(message, e);
- throw e;
- }
- }
- t.enlist(bean);
- }
-
- public RMSBeanMgr getRMSBeanMgr() {
- return rMSBeanMgr;
- }
-
- public RMDBeanMgr getRMDBeanMgr() {
- return rMDBeanMgr;
- }
-
- public SenderBeanMgr getSenderBeanMgr() {
- return senderBeanMgr;
- }
-
- public InvokerBeanMgr getInvokerBeanMgr() {
- return invokerBeanMgr;
- }
-
- public static InMemoryStorageManager getInstance(
- ConfigurationContext context)
- throws SandeshaException
- {
- if (instance == null)
- instance = new InMemoryStorageManager(context);
-
- return instance;
- }
-
- public MessageContext retrieveMessageContext(String key,ConfigurationContext context) throws SandeshaStorageException {
- if(log.isDebugEnabled()) log.debug("Enter: InMemoryStorageManager::retrieveMessageContext, key: " + key);
-
- MessageContext messageContext = null;
- try {
- if(useSerialization) {
- SerializedStorageEntry entry = (SerializedStorageEntry) storageMap.get(key);
-
- if(entry != null) {
- if(entry.message != null) {
- // We have the real message, so use that, but make sure that future users create
- // their own copy.
- messageContext = entry.message;
- entry.message = null;
- } else {
- ByteArrayInputStream stream = new ByteArrayInputStream(entry.data);
- ObjectInputStream is = new ObjectInputStream(stream);
- messageContext = (MessageContext) is.readObject();
- messageContext.activate(entry.context);
-
- OperationContext opCtx = messageContext.getOperationContext();
- if(opCtx != null) {
- MessageContext inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- if(inMsgCtx != null) {
- inMsgCtx.setProperty(RequestResponseTransport.TRANSPORT_CONTROL, entry.inTransportControl);
- inMsgCtx.setProperty(MessageContext.TRANSPORT_OUT, entry.inTransportOut);
- inMsgCtx.setProperty(Constants.OUT_TRANSPORT_INFO, entry.inTransportOutInfo);
- }
- }
-
- messageContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL, entry.transportControl);
- messageContext.setProperty(MessageContext.TRANSPORT_OUT, entry.transportOut);
- messageContext.setProperty(Constants.OUT_TRANSPORT_INFO, entry.transportOutInfo);
- }
- }
-
- } else {
- StorageEntry entry = (StorageEntry) storageMap.get(key);
-
- if(entry != null) {
- messageContext = entry.msgContext;
- SOAPEnvelope clonedEnvelope = SandeshaUtil.cloneEnvelope(entry.envelope);
- messageContext.setEnvelope(clonedEnvelope);
- }
- }
- } catch (Exception e) {
- String message = SandeshaMessageHelper.getMessage(
- SandeshaMessageKeys.failedToLoadMessage, e.toString());
- if(log.isDebugEnabled()) log.debug(message);
- throw new SandeshaStorageException(message, e);
- }
-
- if(log.isDebugEnabled()) log.debug("Exit: InMemoryStorageManager::retrieveMessageContext, " + messageContext);
- return messageContext;
- }
-
- public void storeMessageContext(String key,MessageContext msgContext)
- throws SandeshaStorageException
- {
- if(log.isDebugEnabled()) log.debug("Enter: InMemoryStorageManager::storeMessageContext, key: " + key);
-
- if (key==null)
- key = SandeshaUtil.getUUID();
-
- try {
- if(useSerialization) {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- // Remove the MustUnderstand parts for serialized message
-
- SandeshaUtil.removeMustUnderstand(msgContext.getEnvelope());
- ObjectOutputStream s = new ObjectOutputStream(stream);
- s.writeObject(msgContext);
- s.close();
-
- SerializedStorageEntry entry = new SerializedStorageEntry();
- // Store a reference to the real message, as well as serializing it
- entry.message = msgContext;
- entry.data = stream.toByteArray();
- entry.context = msgContext.getConfigurationContext();
-
- OperationContext opCtx = msgContext.getOperationContext();
- if(opCtx != null) {
- MessageContext inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- if(inMsgCtx != null) {
- entry.inTransportControl = inMsgCtx.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
- entry.inTransportOut = inMsgCtx.getProperty(MessageContext.TRANSPORT_OUT);
- entry.inTransportOutInfo = inMsgCtx.getProperty(Constants.OUT_TRANSPORT_INFO);
- }
- }
- entry.transportControl = msgContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
- entry.transportOut = msgContext.getProperty(MessageContext.TRANSPORT_OUT);
- entry.transportOutInfo = msgContext.getProperty(Constants.OUT_TRANSPORT_INFO);
-
- storageMap.put(key, entry);
-
- } else {
- //We are storing the original envelope here.
- //Storing a cloned version will caus HeaderBlocks to loose their setProcessed information.
- StorageEntry entry = new StorageEntry();
- entry.msgContext = msgContext;
- entry.envelope = msgContext.getEnvelope();
-
- //building the full enveloper before storing.
- SOAPEnvelope envelope = msgContext.getEnvelope();
- envelope.buildWithAttachments();
-
- entry.envelope = envelope;
-
- storageMap.put(key,entry);
- }
- } catch(Exception e) {
- String message = SandeshaMessageHelper.getMessage(
- SandeshaMessageKeys.failedToStoreMessage, e.toString());
- if(log.isDebugEnabled()) log.debug(message);
- throw new SandeshaStorageException(message, e);
- }
-
- if(log.isDebugEnabled()) log.debug("Exit: InMemoryStorageManager::storeMessageContext, key: " + key);
- }
-
- public void updateMessageContext(String key,MessageContext msgContext) throws SandeshaStorageException {
- if(log.isDebugEnabled()) log.debug("Enter: InMemoryStorageManager::updateMessageContext, key: " + key);
-
- Object oldEntry = storageMap.remove(key);
- if (oldEntry==null)
- throw new SandeshaStorageException (SandeshaMessageHelper.getMessage(
- SandeshaMessageKeys.entryNotPresentForUpdating));
-
- storeMessageContext(key,msgContext);
-
- if(log.isDebugEnabled()) log.debug("Exit: InMemoryStorageManager::updateMessageContext, key: " + key);
- }
-
- public void removeMessageContext(String key) {
- if(log.isDebugEnabled()) log.debug("Enter: InMemoryStorageManager::removeMessageContext, key: " + key);
-
- storageMap.remove(key);
-
- if(log.isDebugEnabled()) log.debug("Exit: InMemoryStorageManager::removeMessageContext, key: " + key);
- }
-
- public void initStorage (AxisModule moduleDesc) {
-
- }
-
- private class SerializedStorageEntry {
- MessageContext message;
- byte[] data;
- ConfigurationContext context;
- Object transportControl;
- Object transportOut;
- Object transportOutInfo;
- Object inTransportControl;
- Object inTransportOut;
- Object inTransportOutInfo;
- }
- private class StorageEntry {
- MessageContext msgContext;
- SOAPEnvelope envelope;
- }
-}
-
-
-
-
-
-
-
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package org.apache.sandesha2.storage.inmemory;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Collection;
+import java.util.HashMap;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.transport.RequestResponseTransport;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.policy.SandeshaPolicyBean;
+import org.apache.sandesha2.polling.PollingManager;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.storage.Transaction;
+import org.apache.sandesha2.storage.beanmanagers.RMSBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.InvokerBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.RMDBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr;
+import org.apache.sandesha2.storage.beans.RMBean;
+import org.apache.sandesha2.util.SandeshaUtil;
+import org.apache.sandesha2.workers.Invoker;
+import org.apache.sandesha2.workers.SandeshaThread;
+import org.apache.sandesha2.workers.Sender;
+
+public class InMemoryStorageManager extends StorageManager {
+
+ private static Log log = LogFactory.getLog(InMemoryStorageManager.class);
+
+ private static InMemoryStorageManager instance = null;
+ private RMSBeanMgr rMSBeanMgr = null;
+ private RMDBeanMgr rMDBeanMgr = null;
+ private SenderBeanMgr senderBeanMgr = null;
+ private InvokerBeanMgr invokerBeanMgr = null;
+ private Sender sender = null;
+ private Invoker invoker = null;
+ private PollingManager pollingManager = null;
+ private HashMap transactions = new HashMap();
+ private boolean useSerialization = false;
+ private HashMap storageMap = new HashMap();
+
+ public InMemoryStorageManager(ConfigurationContext context)
+ throws SandeshaException
+ {
+ super(context);
+
+ SandeshaPolicyBean policy = SandeshaUtil.getPropertyBean(context.getAxisConfiguration());
+ useSerialization = policy.isUseMessageSerialization();
+
+ // Note that while inOrder is a global property we can decide if we need the
+ // invoker thread at this point. If we change this to be a sequence-level
+ // property then we'll need to revisit this.
+ boolean inOrder = policy.isInOrder();
+ boolean polling = policy.isEnableMakeConnection();
+
+ this.rMSBeanMgr = new InMemoryRMSBeanMgr (this, context);
+ this.rMDBeanMgr = new InMemoryRMDBeanMgr (this, context);
+ this.senderBeanMgr = new InMemorySenderBeanMgr (this, context);
+ this.invokerBeanMgr = new InMemoryInvokerBeanMgr (this, context);
+ this.sender = new Sender();
+ if(inOrder) this.invoker = new Invoker();
+ if(polling) this.pollingManager = new PollingManager();
+ }
+
+ public Transaction getTransaction() {
+ // Calling getTransaction is the only way to set up a new transaction. If you
+ // do some work that requires a tran without there being a transaction in scope
+ // then the enlist method will throw an exception.
+ Transaction result = null;
+ synchronized (transactions) {
+ Thread key = Thread.currentThread();
+ String name = key.getName();
+ int id = System.identityHashCode(key);
+ result = (Transaction) transactions.get(key);
+ if(result == null) {
+ result = new InMemoryTransaction(this, name, id);
+ transactions.put(key, result);
+ } else {
+ // We don't want to return an existing transaction, as someone else should
+ // decide if we commit it or not. If we get here then we probably have a
+ // bug.
+ if(log.isDebugEnabled()) log.debug("Possible re-used transaction: " + result);
+ result = null;
+ }
+ }
+ return result;
+ }
+
+ InMemoryTransaction getInMemoryTransaction() {
+ InMemoryTransaction result = null;
+ synchronized (transactions) {
+ Thread key = Thread.currentThread();
+ result = (InMemoryTransaction) transactions.get(key);
+ }
+ return result;
+ }
+
+ void removeTransaction(Transaction t) {
+ synchronized (transactions) {
+ Collection entries = transactions.values();
+ entries.remove(t);
+ }
+ }
+
+ /**
+ * Gets the Invoker for this Storage manager
+ */
+ public SandeshaThread getInvoker() {
+ return invoker;
+ }
+
+ /**
+ * Gets the Sender for this Storage manager
+ */
+ public SandeshaThread getSender() {
+ return sender;
+ }
+
+ /**
+ * Gets the PollingManager for this Storage manager
+ */
+ public PollingManager getPollingManager() {
+ return pollingManager;
+ }
+
+ void enlistBean(RMBean bean) throws SandeshaStorageException {
+ InMemoryTransaction t = null;
+ synchronized (transactions) {
+ Thread key = Thread.currentThread();
+ t = (InMemoryTransaction) transactions.get(key);
+ if(t == null) {
+ // We attempted to do some work without a transaction in scope
+ String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noTransaction);
+ SandeshaStorageException e = new SandeshaStorageException(message);
+ if(log.isDebugEnabled()) log.debug(message, e);
+ throw e;
+ }
+ }
+ t.enlist(bean);
+ }
+
+ public RMSBeanMgr getRMSBeanMgr() {
+ return rMSBeanMgr;
+ }
+
+ public RMDBeanMgr getRMDBeanMgr() {
+ return rMDBeanMgr;
+ }
+
+ public SenderBeanMgr getSenderBeanMgr() {
+ return senderBeanMgr;
+ }
+
+ public InvokerBeanMgr getInvokerBeanMgr() {
+ return invokerBeanMgr;
+ }
+
+ public static InMemoryStorageManager getInstance(
+ ConfigurationContext context)
+ throws SandeshaException
+ {
+ if (instance == null)
+ instance = new InMemoryStorageManager(context);
+
+ return instance;
+ }
+
+ public MessageContext retrieveMessageContext(String key,ConfigurationContext context) throws SandeshaStorageException {
+ if(log.isDebugEnabled()) log.debug("Enter: InMemoryStorageManager::retrieveMessageContext, key: " + key);
+
+ MessageContext messageContext = null;
+ try {
+ if(useSerialization) {
+ SerializedStorageEntry entry = (SerializedStorageEntry) storageMap.get(key);
+
+ if(entry != null) {
+ if(entry.message != null) {
+ // We have the real message, so use that, but make sure that future users create
+ // their own copy.
+ messageContext = entry.message;
+ entry.message = null;
+ } else {
+ ByteArrayInputStream stream = new ByteArrayInputStream(entry.data);
+ ObjectInputStream is = new ObjectInputStream(stream);
+ messageContext = (MessageContext) is.readObject();
+ messageContext.activate(entry.context);
+
+ OperationContext opCtx = messageContext.getOperationContext();
+ if(opCtx != null) {
+ MessageContext inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ if(inMsgCtx != null) {
+ inMsgCtx.setProperty(RequestResponseTransport.TRANSPORT_CONTROL, entry.inTransportControl);
+ inMsgCtx.setProperty(MessageContext.TRANSPORT_OUT, entry.inTransportOut);
+ inMsgCtx.setProperty(Constants.OUT_TRANSPORT_INFO, entry.inTransportOutInfo);
+ }
+ }
+
+ messageContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL, entry.transportControl);
+ messageContext.setProperty(MessageContext.TRANSPORT_OUT, entry.transportOut);
+ messageContext.setProperty(Constants.OUT_TRANSPORT_INFO, entry.transportOutInfo);
+ }
+ }
+
+ } else {
+ StorageEntry entry = (StorageEntry) storageMap.get(key);
+
+ if(entry != null) {
+ messageContext = entry.msgContext;
+ SOAPEnvelope clonedEnvelope = SandeshaUtil.cloneEnvelope(entry.envelope);
+ messageContext.setEnvelope(clonedEnvelope);
+ }
+ }
+ } catch (Exception e) {
+ String message = SandeshaMessageHelper.getMessage(
+ SandeshaMessageKeys.failedToLoadMessage, e.toString());
+ if(log.isDebugEnabled()) log.debug(message);
+ throw new SandeshaStorageException(message, e);
+ }
+
+ if(log.isDebugEnabled()) log.debug("Exit: InMemoryStorageManager::retrieveMessageContext, " + messageContext);
+ return messageContext;
+ }
+
+ public void storeMessageContext(String key,MessageContext msgContext)
+ throws SandeshaStorageException
+ {
+ if(log.isDebugEnabled()) log.debug("Enter: InMemoryStorageManager::storeMessageContext, key: " + key);
+
+ if (key==null)
+ key = SandeshaUtil.getUUID();
+
+ try {
+ if(useSerialization) {
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ // Remove the MustUnderstand parts for serialized message
+
+ SandeshaUtil.removeMustUnderstand(msgContext.getEnvelope());
+ ObjectOutputStream s = new ObjectOutputStream(stream);
+ s.writeObject(msgContext);
+ s.close();
+
+ SerializedStorageEntry entry = new SerializedStorageEntry();
+ // Store a reference to the real message, as well as serializing it
+ entry.message = msgContext;
+ entry.data = stream.toByteArray();
+ entry.context = msgContext.getConfigurationContext();
+
+ OperationContext opCtx = msgContext.getOperationContext();
+ if(opCtx != null) {
+ MessageContext inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ if(inMsgCtx != null) {
+ entry.inTransportControl = inMsgCtx.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
+ entry.inTransportOut = inMsgCtx.getProperty(MessageContext.TRANSPORT_OUT);
+ entry.inTransportOutInfo = inMsgCtx.getProperty(Constants.OUT_TRANSPORT_INFO);
+ }
+ }
+ entry.transportControl = msgContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
+ entry.transportOut = msgContext.getProperty(MessageContext.TRANSPORT_OUT);
+ entry.transportOutInfo = msgContext.getProperty(Constants.OUT_TRANSPORT_INFO);
+
+ storageMap.put(key, entry);
+
+ } else {
+ //We are storing the original envelope here.
+ //Storing a cloned version will caus HeaderBlocks to loose their setProcessed information.
+ StorageEntry entry = new StorageEntry();
+ entry.msgContext = msgContext;
+ entry.envelope = msgContext.getEnvelope();
+
+ //building the full enveloper before storing.
+ SOAPEnvelope envelope = msgContext.getEnvelope();
+ envelope.buildWithAttachments();
+
+ entry.envelope = envelope;
+
+ storageMap.put(key,entry);
+ }
+ } catch(Exception e) {
+ String message = SandeshaMessageHelper.getMessage(
+ SandeshaMessageKeys.failedToStoreMessage, e.toString());
+ if(log.isDebugEnabled()) log.debug(message);
+ throw new SandeshaStorageException(message, e);
+ }
+
+ if(log.isDebugEnabled()) log.debug("Exit: InMemoryStorageManager::storeMessageContext, key: " + key);
+ }
+
+ public void updateMessageContext(String key,MessageContext msgContext) throws SandeshaStorageException {
+ if(log.isDebugEnabled()) log.debug("Enter: InMemoryStorageManager::updateMessageContext, key: " + key);
+
+ Object oldEntry = storageMap.remove(key);
+ if (oldEntry==null)
+ throw new SandeshaStorageException (SandeshaMessageHelper.getMessage(
+ SandeshaMessageKeys.entryNotPresentForUpdating));
+
+ storeMessageContext(key,msgContext);
+
+ if(log.isDebugEnabled()) log.debug("Exit: InMemoryStorageManager::updateMessageContext, key: " + key);
+ }
+
+ public void removeMessageContext(String key) {
+ if(log.isDebugEnabled()) log.debug("Enter: InMemoryStorageManager::removeMessageContext, key: " + key);
+
+ storageMap.remove(key);
+
+ if(log.isDebugEnabled()) log.debug("Exit: InMemoryStorageManager::removeMessageContext, key: " + key);
+ }
+
+ public void initStorage (AxisModule moduleDesc) {
+
+ }
+
+ private class SerializedStorageEntry {
+ MessageContext message;
+ byte[] data;
+ ConfigurationContext context;
+ Object transportControl;
+ Object transportOut;
+ Object transportOutInfo;
+ Object inTransportControl;
+ Object inTransportOut;
+ Object inTransportOutInfo;
+ }
+ private class StorageEntry {
+ MessageContext msgContext;
+ SOAPEnvelope envelope;
+ }
+}
+
+
+
+
+
+
+
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryStorageManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java Wed Aug 8 17:51:29 2007
@@ -1,168 +1,168 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- *
- */
-
-package org.apache.sandesha2.storage.inmemory;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sandesha2.i18n.SandeshaMessageHelper;
-import org.apache.sandesha2.i18n.SandeshaMessageKeys;
-import org.apache.sandesha2.storage.SandeshaStorageException;
-import org.apache.sandesha2.storage.Transaction;
-import org.apache.sandesha2.storage.beans.RMBean;
-import org.apache.sandesha2.workers.SandeshaThread;
-
-/**
- * This class does not really implement transactions, but it is a good
- * place to implement locking for the in memory storage manager.
- */
-
-public class InMemoryTransaction implements Transaction {
-
- private static final Log log = LogFactory.getLog(InMemoryTransaction.class);
-
- private InMemoryStorageManager manager;
- private String threadName;
- private int threadId;
- private ArrayList enlistedBeans = new ArrayList();
- private InMemoryTransaction waitingForTran = null;
- private boolean sentMessages = false;
- private boolean receivedMessages = false;
- private boolean active = true;
-
- InMemoryTransaction(InMemoryStorageManager manager, String threadName, int id) {
- if(log.isDebugEnabled()) log.debug("Entry: InMemoryTransaction::<init>");
- this.manager = manager;
- this.threadName = threadName;
- this.threadId = id;
- if(log.isDebugEnabled()) log.debug("Exit: InMemoryTransaction::<init>, " + this);
- }
-
- public void commit() {
- releaseLocks();
- if(sentMessages) manager.getSender().wakeThread();
- if(receivedMessages) {
- SandeshaThread invoker = manager.getInvoker();
- if(invoker != null) invoker.wakeThread();
- }
- active = false;
- }
-
- public void rollback() {
- releaseLocks();
- active = false;
- }
-
- public boolean isActive () {
- return active;
- }
-
- public void enlist(RMBean bean) throws SandeshaStorageException {
- if(log.isDebugEnabled()) log.debug("Entry: InMemoryTransaction::enlist, " + bean);
- if(bean != null) {
- synchronized (bean) {
- InMemoryTransaction other = (InMemoryTransaction) bean.getTransaction();
- while(other != null && other != this) {
- // Put ourselves into the list of waiters
- waitingForTran = other;
-
- // Look to see if there is a loop in the chain of waiters
- if(!enlistedBeans.isEmpty()) {
- HashSet set = new HashSet();
- set.add(this);
- while(other != null) {
- if(set.contains(other)) {
- String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.deadlock, this.toString(), bean.toString());
- SandeshaStorageException e = new SandeshaStorageException(message);
-
- // Do our best to get out of the way of the other work in the system
- waitingForTran = null;
- releaseLocks();
-
- if(log.isDebugEnabled()) log.debug(message, e);
- throw e;
- }
- set.add(other);
- other = other.waitingForTran;
- }
- }
-
- try {
- if(log.isDebugEnabled()) log.debug("This " + this + " waiting for " + waitingForTran);
- bean.wait();
- } catch(InterruptedException e) {
- // Do nothing
- }
- other = (InMemoryTransaction) bean.getTransaction();
- }
-
- waitingForTran = null;
- if(other == null) {
- if(log.isDebugEnabled()) log.debug(this + " locking bean");
- bean.setTransaction(this);
- enlistedBeans.add(bean);
- }
- }
- }
-
- if(log.isDebugEnabled()) log.debug("Exit: InMemoryTransaction::enlist");
- }
-
- private void releaseLocks() {
- if(log.isDebugEnabled()) log.debug("Entry: InMemoryTransaction::releaseLocks, " + this);
- manager.removeTransaction(this);
-
- Iterator beans = enlistedBeans.iterator();
- while(beans.hasNext()) {
- RMBean bean = (RMBean) beans.next();
- synchronized (bean) {
- bean.setTransaction(null);
- bean.notify();
- }
- }
- enlistedBeans.clear();
-
- if(log.isDebugEnabled()) log.debug("Exit: InMemoryTransaction::releaseLocks");
- }
-
- public String toString() {
- StringBuffer result = new StringBuffer();
- result.append("[InMemoryTransaction, id:");
- result.append(threadId);
- result.append(", name: ");
- result.append(threadName);
- result.append(", locks: ");
- result.append(enlistedBeans.size());
- result.append("]");
- return result.toString();
- }
-
- public void setReceivedMessages(boolean receivedMessages) {
- this.receivedMessages = receivedMessages;
- }
-
- public void setSentMessages(boolean sentMessages) {
- this.sentMessages = sentMessages;
- }
-}
-
-
-
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package org.apache.sandesha2.storage.inmemory;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.i18n.SandeshaMessageHelper;
+import org.apache.sandesha2.i18n.SandeshaMessageKeys;
+import org.apache.sandesha2.storage.SandeshaStorageException;
+import org.apache.sandesha2.storage.Transaction;
+import org.apache.sandesha2.storage.beans.RMBean;
+import org.apache.sandesha2.workers.SandeshaThread;
+
+/**
+ * This class does not really implement transactions, but it is a good
+ * place to implement locking for the in memory storage manager.
+ */
+
+public class InMemoryTransaction implements Transaction {
+
+ private static final Log log = LogFactory.getLog(InMemoryTransaction.class);
+
+ private InMemoryStorageManager manager;
+ private String threadName;
+ private int threadId;
+ private ArrayList enlistedBeans = new ArrayList();
+ private InMemoryTransaction waitingForTran = null;
+ private boolean sentMessages = false;
+ private boolean receivedMessages = false;
+ private boolean active = true;
+
+ InMemoryTransaction(InMemoryStorageManager manager, String threadName, int id) {
+ if(log.isDebugEnabled()) log.debug("Entry: InMemoryTransaction::<init>");
+ this.manager = manager;
+ this.threadName = threadName;
+ this.threadId = id;
+ if(log.isDebugEnabled()) log.debug("Exit: InMemoryTransaction::<init>, " + this);
+ }
+
+ public void commit() {
+ releaseLocks();
+ if(sentMessages) manager.getSender().wakeThread();
+ if(receivedMessages) {
+ SandeshaThread invoker = manager.getInvoker();
+ if(invoker != null) invoker.wakeThread();
+ }
+ active = false;
+ }
+
+ public void rollback() {
+ releaseLocks();
+ active = false;
+ }
+
+ public boolean isActive () {
+ return active;
+ }
+
+ public void enlist(RMBean bean) throws SandeshaStorageException {
+ if(log.isDebugEnabled()) log.debug("Entry: InMemoryTransaction::enlist, " + bean);
+ if(bean != null) {
+ synchronized (bean) {
+ InMemoryTransaction other = (InMemoryTransaction) bean.getTransaction();
+ while(other != null && other != this) {
+ // Put ourselves into the list of waiters
+ waitingForTran = other;
+
+ // Look to see if there is a loop in the chain of waiters
+ if(!enlistedBeans.isEmpty()) {
+ HashSet set = new HashSet();
+ set.add(this);
+ while(other != null) {
+ if(set.contains(other)) {
+ String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.deadlock, this.toString(), bean.toString());
+ SandeshaStorageException e = new SandeshaStorageException(message);
+
+ // Do our best to get out of the way of the other work in the system
+ waitingForTran = null;
+ releaseLocks();
+
+ if(log.isDebugEnabled()) log.debug(message, e);
+ throw e;
+ }
+ set.add(other);
+ other = other.waitingForTran;
+ }
+ }
+
+ try {
+ if(log.isDebugEnabled()) log.debug("This " + this + " waiting for " + waitingForTran);
+ bean.wait();
+ } catch(InterruptedException e) {
+ // Do nothing
+ }
+ other = (InMemoryTransaction) bean.getTransaction();
+ }
+
+ waitingForTran = null;
+ if(other == null) {
+ if(log.isDebugEnabled()) log.debug(this + " locking bean");
+ bean.setTransaction(this);
+ enlistedBeans.add(bean);
+ }
+ }
+ }
+
+ if(log.isDebugEnabled()) log.debug("Exit: InMemoryTransaction::enlist");
+ }
+
+ private void releaseLocks() {
+ if(log.isDebugEnabled()) log.debug("Entry: InMemoryTransaction::releaseLocks, " + this);
+ manager.removeTransaction(this);
+
+ Iterator beans = enlistedBeans.iterator();
+ while(beans.hasNext()) {
+ RMBean bean = (RMBean) beans.next();
+ synchronized (bean) {
+ bean.setTransaction(null);
+ bean.notify();
+ }
+ }
+ enlistedBeans.clear();
+
+ if(log.isDebugEnabled()) log.debug("Exit: InMemoryTransaction::releaseLocks");
+ }
+
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ result.append("[InMemoryTransaction, id:");
+ result.append(threadId);
+ result.append(", name: ");
+ result.append(threadName);
+ result.append(", locks: ");
+ result.append(enlistedBeans.size());
+ result.append("]");
+ return result.toString();
+ }
+
+ public void setReceivedMessages(boolean receivedMessages) {
+ this.receivedMessages = receivedMessages;
+ }
+
+ public void setSentMessages(boolean sentMessages) {
+ this.sentMessages = sentMessages;
+ }
+}
+
+
+
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryTransaction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/transport/Sandesha2TransportOutDesc.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/transport/Sandesha2TransportOutDesc.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/transport/Sandesha2TransportOutDesc.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/transport/Sandesha2TransportOutDesc.java Wed Aug 8 17:51:29 2007
@@ -1,29 +1,29 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- *
- */
-
-package org.apache.sandesha2.transport;
-
-import org.apache.axis2.description.TransportOutDescription;
-
-public class Sandesha2TransportOutDesc extends TransportOutDescription {
-
- public Sandesha2TransportOutDesc() {
- super ("Sandesha2TransportOutDesc");
- this.setSender(new Sandesha2TransportSender ());
- }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package org.apache.sandesha2.transport;
+
+import org.apache.axis2.description.TransportOutDescription;
+
+public class Sandesha2TransportOutDesc extends TransportOutDescription {
+
+ public Sandesha2TransportOutDesc() {
+ super ("Sandesha2TransportOutDesc");
+ this.setSender(new Sandesha2TransportSender ());
+ }
+
+}
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/transport/Sandesha2TransportOutDesc.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/transport/Sandesha2TransportSender.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/util/AcknowledgementManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/core/src/main/java/org/apache/sandesha2/util/FaultManager.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org