User: azakkerman
Date: 02/02/03 12:14:59
Modified: varia/src/main/org/jboss/tm/plugins/tyrex
ResourceInvoker.java TransactionManagerService.java
TransactionManagerServiceMBean.java
TyrexTransactionPropagationContextManager.java
TyrexTxPropagationContext.java
Log:
Update of Tyrex plugin sources for JBoss 3.0
Revision Changes Path
1.3 +11 -8
contrib/varia/src/main/org/jboss/tm/plugins/tyrex/ResourceInvoker.java
Index: ResourceInvoker.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/varia/src/main/org/jboss/tm/plugins/tyrex/ResourceInvoker.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ResourceInvoker.java 2001/09/01 19:50:29 1.2
+++ ResourceInvoker.java 2002/02/03 20:14:58 1.3
@@ -18,7 +18,9 @@
import java.io.Externalizable;
import java.io.IOException;
+import org.apache.log4j.Category;
+
/**
* This is the InvocationHandler for the Proxy we hand over to the
* originator's Coordinator to control our subordinate transaction
@@ -29,7 +31,7 @@
* ResourceRemote,
* CoordinatorRemote
* @author <a href="mailto:[EMAIL PROTECTED]">Anatoly Akkerman</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class ResourceInvoker implements InvocationHandler, Externalizable {
@@ -54,6 +56,7 @@
}
}
+ private Category log = Category.getInstance(this.getClass());
private ResourceRemoteInterface remoteResource;
public ResourceInvoker() {
@@ -66,7 +69,7 @@
} catch (Exception e) {
e.printStackTrace();
remoteResource = null;
- Logger.warning("ResourceInvoker did not initialize properly! Ther will be
problems with this transaction!");
+ log.warn("ResourceInvoker did not initialize properly! Ther will be problems
with this transaction!");
}
}
@@ -83,26 +86,26 @@
// Just call the appropriate method on our RemoteCoordinator
if (method.equals(prepare)) {
- // DEBUG Logger.debug("ResourceInvoker: calling prepare()");
+ // DEBUG log.debug("ResourceInvoker: calling prepare()");
return remoteResource.prepare();
}
else if (method.equals(rollback)) {
- // DEBUG Logger.debug("ResourceInvoker: calling rollback()");
+ // DEBUG log.debug("ResourceInvoker: calling rollback()");
remoteResource.rollback();
return null;
}
else if (method.equals(commit)) {
- // DEBUG Logger.debug("ResourceInvoker: calling commit()");
+ // DEBUG log.debug("ResourceInvoker: calling commit()");
remoteResource.commit();
return null;
}
else if (method.equals(commit_one_phase)) {
- // DEBUG Logger.debug("ResourceInvoker: calling commit_one_phase()");
+ // DEBUG log.debug("ResourceInvoker: calling commit_one_phase()");
remoteResource.commit_one_phase();
return null;
}
else if (method.equals(forget)) {
- // DEBUG Logger.debug("ResourceInvoker: calling forget()");
+ // DEBUG log.debug("ResourceInvoker: calling forget()");
remoteResource.forget();
return null;
}
@@ -110,4 +113,4 @@
throw new Exception("ResourceInvoker: called through an unknown method!");
}
}
-}
\ No newline at end of file
+}
1.5 +16 -8
contrib/varia/src/main/org/jboss/tm/plugins/tyrex/TransactionManagerService.java
Index: TransactionManagerService.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/varia/src/main/org/jboss/tm/plugins/tyrex/TransactionManagerService.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TransactionManagerService.java 2001/10/20 21:01:43 1.4
+++ TransactionManagerService.java 2002/02/03 20:14:58 1.5
@@ -26,8 +26,10 @@
import tyrex.tm.TransactionDomain;
import org.omg.CosTransactions.TransactionFactory;
-import org.jboss.util.ServiceMBeanSupport;
+import org.jboss.system.ServiceMBeanSupport;
+import org.apache.log4j.Category;
+
/**
* This is a JMX service which manages the Tyrex TransactionManager
(tyrex.exolab.org).
* The service creates it and binds a Reference to it into JNDI. It also
initializes
@@ -35,12 +37,14 @@
*
* @see TyrexTransactionPropagationContextManager, tyrex.tm.TransactionDomain
* @author <a href="mailto:[EMAIL PROTECTED]">Anatoly Akkerman</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class TransactionManagerService
extends ServiceMBeanSupport
implements TransactionManagerServiceMBean, ObjectFactory
{
+ // Private ----
+ Category log = Category.getInstance(this.getClass());
// Constants -----------------------------------------------------
public static String JNDI_NAME = "java:/TransactionManager";
public static String JNDI_TPC_SENDER = "java:/TPCSender";
@@ -116,7 +120,7 @@
ctx.unbind(JNDI_IMPORTER);
ctx.unbind(JNDI_EXPORTER);
} catch (Exception e) {
- log.exception(e);
+ log.error(e);
}
}
@@ -136,17 +140,20 @@
catch(MalformedURLException e)
{
// Try to resolve the name as a classpath resource
+ /*
ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL url = loader.getResource(name);
if( url == null )
{
String msg = "Failed to find name: "+name+" as either a URL or a
classpath resource";
- category.error(msg);
+ log.error(msg);
throw new IOException(msg);
}
configFile = url.toExternalForm();
+ */
+ configFile = name;
}
- category.info("Using configFile: "+configFile);
+ log.info("Using configFile: "+configFile);
}
// ObjectFactory implementation ----------------------------------
@@ -179,11 +186,12 @@
catch (NamingException e) {
e.printStackTrace();
}
+
+// DEBUG log.debug("Obtaining object instance for: " + name);
-// DEBUG Logger.debug("Obtaining object instance for: " + name);
// DEBUG
/*
- Logger.debug("My composite names: " + tmName +
+ log.debug("My composite names: " + tmName +
", " + senderName +
", " + receiverName +
", " + exporterName +
@@ -202,7 +210,7 @@
return tpcManager;
}
else {
- Logger.warning("TransactionManagerService: requested an unknown object:" +
name);
+ log.warn("TransactionManagerService: requested an unknown object:" + name);
return null;
}
1.5 +5 -3
contrib/varia/src/main/org/jboss/tm/plugins/tyrex/TransactionManagerServiceMBean.java
Index: TransactionManagerServiceMBean.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/varia/src/main/org/jboss/tm/plugins/tyrex/TransactionManagerServiceMBean.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TransactionManagerServiceMBean.java 2002/01/03 04:00:55 1.4
+++ TransactionManagerServiceMBean.java 2002/02/03 20:14:58 1.5
@@ -15,15 +15,17 @@
*
* @see TransactionManagerService
* @author <a href="mailto:[EMAIL PROTECTED]">Anatoly Akkerman</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public interface TransactionManagerServiceMBean
extends org.jboss.system.ServiceMBean
{
- String OBJECT_NAME = "jboss:service=TransactionManager";
+ // Constants -----------------------------------------------------
+ public static final String OBJECT_NAME = ":service=TransactionManager";
- String getConfigFileName();
+ // Public --------------------------------------------------------
+ public String getConfigFileName();
- void setConfigFileName(String name) throws IOException;
+ public void setConfigFileName(String name) throws IOException;
}
1.3 +12 -9
contrib/varia/src/main/org/jboss/tm/plugins/tyrex/TyrexTransactionPropagationContextManager.java
Index: TyrexTransactionPropagationContextManager.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/varia/src/main/org/jboss/tm/plugins/tyrex/TyrexTransactionPropagationContextManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TyrexTransactionPropagationContextManager.java 2001/09/01 19:50:29 1.2
+++ TyrexTransactionPropagationContextManager.java 2002/02/03 20:14:58 1.3
@@ -13,6 +13,7 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
+import org.apache.log4j.Category;
import tyrex.tm.TransactionDomain;
import org.omg.CosTransactions.PropagationContextHolder;
@@ -26,7 +27,7 @@
*
* @see TransactionManagerService
* @author <a href="mailto:[EMAIL PROTECTED]">Anatoly Akkerman</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class TyrexTransactionPropagationContextManager implements
@@ -44,6 +45,8 @@
private Receiver receiver = null;
private TransactionManager tm = null;
+ private Category log = Category.getInstance(this.getClass());
+
// -- Constructors ----------------------------------------------------
protected TyrexTransactionPropagationContextManager() {
try {
@@ -74,15 +77,15 @@
// now modify the tpc that is inside this tpcHolder and package it
// into a serializable entity
tpc = new TyrexTxPropagationContext(tpcHolder.value);
- // DEBUG Logger.debug("Exporting a transaction");
+ // DEBUG log.debug("Exporting a transaction");
} else {
// this tpc represents a null transaction and will be propagated to remote
side
tpc = new TyrexTxPropagationContext();
- // DEBUG Logger.debug("Exporting null transaction");
+ // DEBUG log.debug("Exporting null transaction");
}
} catch (Exception e) {
// DEBUG
- Logger.warning ("TyrexTransactionPropagationContextManager: unable to create
propagation ctx!");
+ log.warn ("TyrexTransactionPropagationContextManager: unable to create
propagation ctx!");
e.printStackTrace();
} finally {
return tpc;
@@ -126,7 +129,7 @@
if (tpc instanceof TyrexTxPropagationContext) {
Transaction oldTx;
try {
- // DEBUG Logger.debug ("TyrexTransactionPropagationContextManager:
importing tpc.");
+ // DEBUG log.debug ("TyrexTransactionPropagationContextManager:
importing tpc.");
oldTx = tm.suspend(); //cleanup the incoming thread
PropagationContext omgTpc = ((TyrexTxPropagationContext)
tpc).getPropagationContext();
@@ -143,9 +146,9 @@
if (oldTx != null)
tm.resume(oldTx);
} else {
- //DEBUG Logger.debug("Importing null transaction");
+ //DEBUG log.debug("Importing null transaction");
}
- // DEBUG Logger.debug ("TyrexTransactionPropagationContextManager:
transaction imported.");
+ // DEBUG log.debug ("TyrexTransactionPropagationContextManager:
transaction imported.");
return newTx;
} catch (Exception e) {
e.printStackTrace();
@@ -153,8 +156,8 @@
}
}
else {
- Logger.warning("TyrexTransactionPropagationContextManager: unknown Tx
PropagationContex");
+ log.warn("TyrexTransactionPropagationContextManager: unknown Tx
PropagationContex");
return null;
}
}
-}
\ No newline at end of file
+}
1.3 +16 -12
contrib/varia/src/main/org/jboss/tm/plugins/tyrex/TyrexTxPropagationContext.java
Index: TyrexTxPropagationContext.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/varia/src/main/org/jboss/tm/plugins/tyrex/TyrexTxPropagationContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TyrexTxPropagationContext.java 2001/09/01 19:50:29 1.2
+++ TyrexTxPropagationContext.java 2002/02/03 20:14:58 1.3
@@ -20,6 +20,8 @@
import org.omg.CosTransactions.Resource;
import org.omg.CosTransactions.otid_t;
+import org.apache.log4j.Category;
+
// We need this to make a proxy for the OMG Coordinator for the remote site
import java.lang.reflect.Proxy;
@@ -37,11 +39,13 @@
* org.omg.CosTransactions.Coordinator,
* java.lang.reflect.Proxy
* @author <a href="mailto:[EMAIL PROTECTED]">Anatoly Akkerman</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class TyrexTxPropagationContext implements Externalizable {
+ private Category log = Category.getInstance(this.getClass());
+
public TyrexTxPropagationContext() {
// public, no args constructor for externalization to work
@@ -54,12 +58,12 @@
this.timeout = tpc.timeout;
this.coord = new CoordinatorRemote(tpc.current.coord);
this.otid = tpc.current.otid;
- // DEBUG Logger.debug("TyrexTxPropagationContext: created new tpc");
+ // DEBUG log.debug("TyrexTxPropagationContext: created new tpc");
} catch (RemoteException e) {
// should never happen, we are instantiating the RemoteCoordinator
// locally
e.printStackTrace();
- Logger.warning("Impossible, CoordinatorRemote threw a RemoteException!");
+ log.warn("Impossible, CoordinatorRemote threw a RemoteException!");
}
}
@@ -81,7 +85,7 @@
null);
}
- // DEBUG Logger.debug("TyrexTxPropagationContext recreated
PropagationContext");
+ // DEBUG log.debug("TyrexTxPropagationContext recreated PropagationContext");
return tpc;
}
@@ -90,14 +94,14 @@
out.writeBoolean(this.isNull);
if (! isNull) {
out.writeInt(this.timeout);
- // DEBUG Logger.debug("TPC: wrote timeout");
+ // DEBUG log.debug("TPC: wrote timeout");
out.writeObject(this.coord);
- // DEBUG Logger.debug("TPC: wrote CoordinatorRemote stub");
+ // DEBUG log.debug("TPC: wrote CoordinatorRemote stub");
out.writeObject(this.otid); // otid implements IDLEntity which extends
Serializable
- // DEBUG Logger.debug("TPC: wrote otid");
+ // DEBUG log.debug("TPC: wrote otid");
}
} catch (Exception e) {
- Logger.warning("Unable to externalize tpc!");
+ log.warn("Unable to externalize tpc!");
e.printStackTrace();
throw new IOException(e.toString());
}
@@ -108,11 +112,11 @@
this.isNull = in.readBoolean();
if (!isNull) {
this.timeout = in.readInt();
- // DEBUG Logger.debug("TPC: read timeout");
+ // DEBUG log.debug("TPC: read timeout");
this.coord = (CoordinatorRemoteInterface) in.readObject();
- // DEBUG Logger.debug("TPC: read coordinator stub");
+ // DEBUG log.debug("TPC: read coordinator stub");
this.otid = (otid_t) in.readObject();
- // DEBUG Logger.debug("TPC: read otid");
+ // DEBUG log.debug("TPC: read otid");
}
} catch (Exception e) {
e.printStackTrace();
@@ -148,4 +152,4 @@
// it the Resource proxy instead of the actual Resource, so that the
// coordination can proceed through RMI rather than CORBA
protected Coordinator coordProxy = null;
-}
\ No newline at end of file
+}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development