Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2009, Red Hat Middleware LLC, and individual contributors
   * as indicated by the @author tags.
   * See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   * This copyrighted material is made available to anyone wishing to use,
   * modify, copy, or redistribute it subject to the terms and conditions
   * of the GNU Lesser General Public License, v. 2.1.
  * This program is distributed in the hope that it will be useful, but WITHOUT A
  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public License,
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  *
  * (C) 2009,
  * @author JBoss, a division of Red Hat.
  */
 package com.arjuna.ats.arjuna.common;
 
 
 import java.io.File;
 
A JavaBean containing assorted configuration properties for the core transaction system.

Author(s):
Jonathan Halliday (jonathan.halliday@redhat.com)
 
 @PropertyPrefix(prefix = "com.arjuna.ats.arjuna.")
 public class CoreEnvironmentBean implements CoreEnvironmentBeanMBean
 {
     public static final int NODE_NAME_SIZE = 64;
 
     @FullPropertyName(name = "com.arjuna.ats.arjuna.common.varDir")
     private volatile String varDir = System.getProperty("user.dir") + . + "var" + . + "tmp";
 
     @FullPropertyName(name = "com.arjuna.ats.arjuna.nodeIdentifier")
     private volatile String nodeIdentifier = null;
 
     @FullPropertyName(name = "com.arjuna.ats.internal.arjuna.utils.SocketProcessIdPort")
     private volatile int socketProcessIdPort = 0;
     @FullPropertyName(name = "com.arjuna.ats.internal.arjuna.utils.SocketProcessIdMaxPorts")
     private volatile int socketProcessIdMaxPorts = 1;
 
     @FullPropertyName(name = "com.arjuna.ats.internal.arjuna.utils.processImplementation")
     private volatile String processImplementationClassName = Utility.getDefaultProcessId();
     private volatile Process processImplementation = null;
 
     @FullPropertyName(name = "com.arjuna.ats.internal.arjuna.utils.pid")
     private volatile int pid = -1;
 
     private volatile boolean allowMultipleLastResources = false;
     private volatile boolean disableMultipleLastResourcesWarning = false;
 
     @FullPropertyName(name = "timeout.factor")
     private volatile int timeoutFactor = 1;

    
Returns the 'var' directory path. Default: {user.dir}/var/tmp Equivalent deprecated property: com.arjuna.ats.arjuna.common.varDir

Returns:
the 'var' directory name.
 
     public String getVarDir()
     {
         return ;
     }

    
Sets the 'var' directory path

Parameters:
varDir the path to the 'var' directory.
 
     public void setVarDir(String varDir)
     {
         this. = varDir;
     }

    
Returns the Node Identifier. Default: null Equivalent deprecated property: com.arjuna.ats.arjuna.nodeIdentifier

Returns:
the Node Identifier.
 
    public String getNodeIdentifier()
    {
        return ;
    }

    
Sets the node identifier. Should be uniq amongst all instances that share resource managers or an objectstore.

Parameters:
nodeIdentifier the Node Identifier.
Throws:
CoreEnvironmentBeanException if node identifier is null or too long.
    public void setNodeIdentifier(String nodeIdentifierthrows CoreEnvironmentBeanException
    {
        if (nodeIdentifier == null)
        {
            ..fatal_nodename_null();
        }
        if (nodeIdentifier.getBytes().length > )
        {
            ..fatal_nodename_too_long(nodeIdentifier);
            throw new CoreEnvironmentBeanException(..get_fatal_nodename_too_long(nodeIdentifier));
        }
    	this. = nodeIdentifier;
    }

    
Returns the port number for the Socket based process id implementation. Default: 0 (use any free port) Equivalent deprecated property: com.arjuna.ats.internal.arjuna.utils.SocketProcessIdPort

Returns:
the port number.
    public int getSocketProcessIdPort()
    {
        return ;
    }

    
Sets the port on which the socket based process id implementation will listen. Should be uniq amongst all instances on the same host. A value of 0 will result in a random port.

Parameters:
socketProcessIdPort the port number to bind to.
    public void setSocketProcessIdPort(int socketProcessIdPort)
    {
        Utility.validatePortRange(socketProcessIdPort);
        this. = socketProcessIdPort;
    }
    public int getTimeoutFactor()
    {
        return ;
    }
    public void setTimeoutFactor(int timeoutFactor)
    {
        this. = timeoutFactor;
    }

    
Returns the maximum number of ports to search when looking for one that is free. Default: 1 Equivalent deprecated property: com.arjuna.ats.internal.arjuna.utils.SocketProcessIdMaxPorts

Returns:
the maximum number of ports to try.
    public int getSocketProcessIdMaxPorts()
    {
        return ;
    }

    
Sets the maximum number of ports the socket process id implemention will try when searching to find one that is free.

Parameters:
socketProcessIdMaxPorts the maximum number of ports to try.
    public void setSocketProcessIdMaxPorts(int socketProcessIdMaxPorts)
    {
        this. = socketProcessIdMaxPorts;
    }

    
Returns the class name of the Process implementation to use. Default: "com.arjuna.ats.internal.arjuna.utils.SocketProcessId" Equivalent deprecated property: com.arjuna.ats.internal.arjuna.utils.processImplementation

Returns:
the name of a class implementing Process.
    {
        return ;
    }

    
Sets the class name of the Process implementation to use.

Parameters:
processImplementationClassName the name of a class implementing Process.
    public void setProcessImplementationClassName(String processImplementationClassName)
    {
        synchronized(this) {
            if(processImplementationClassName == null)
            {
                this. = null;
            }
            else if(!processImplementationClassName.equals(this.))
            {
                this. = null;
            }
            this. = processImplementationClassName;
        }
    }

    
Returns an instance of a class implementing com.arjuna.ats.arjuna.utils.Process. If there is no pre-instantiated instance set and classloading or instantiation fails, this method will log an appropriate warning and return null, not throw an exception.

Returns:
a Process implementation instance, or null.
    {
        if( == null &&  != null)
        {
            synchronized(this) {
                if( == null &&  != null) {
                    try
                    {
                         = ClassloadingUtility.loadAndInstantiateClass(Process.classnull);
                    }
                    catch (final java.lang.NoClassDefFoundError ex)
                    {
                        if (Utility.isAndroid())  // todo android
                            return new AndroidProcessId();
                        else
                            throw ex;
                    }
                }
            }
        }
        return ;
    }

    
Sets the instance of com.arjuna.ats.arjuna.utils.Process

Parameters:
instance an Object that implements Process, or null.
    public void setProcessImplementation(Process instance)
    {
        synchronized(this)
        {
            Process oldInstance = this.;
             = instance;
            if(instance == null)
            {
                this. = null;
            }
            else if(instance != oldInstance)
            {
                String name = ClassloadingUtility.getNameForClass(instance);
                this. = name;
            }
        }
    }

    
Returns the process id to use if ManualProcessId is selected. Should be uniq across all instances on the same host. Default: -1 (invalid, must be changed if used) Equivalent deprecated property: com.arjuna.ats.internal.arjuna.utils.pid

Returns:
the process id to use.
    public int getPid()
    {
        return ;
    }

    
Sets the process id to use if ManualProcessId is selected. Should be on the range 1-65535 and uniq across all instances on the same host.

Parameters:
pid the process id to use.
    public void setPid(int pid)
    {
        this. = pid;
    }

    
Returns if multiple last (i.e. one-phase) resources are allowed in the same transaction or not. Default: false Equivalent deprecated property: com.arjuna.ats.arjuna.allowMultipleLastResources

Returns:
true if multiple last resources are permitted, false otherwise.
    public boolean isAllowMultipleLastResources()
    {
        return ;
    }

    
Sets if multiple last (i.e. one-phase) resources are allowed in the same transaction or not. Caution: setting a value of true weakens transactional (ACID) guarantees and is not recommended.

Parameters:
allowMultipleLastResources true if multiple 1PC resource should be permitted, false otherwise.
    public void setAllowMultipleLastResources(boolean allowMultipleLastResources)
    {
        this. = allowMultipleLastResources;
    }

    
Returns if the per-transaction warning on enlistment of multiple last resources is disabled or not. Default: false. Equivalent deprecated property: com.arjuna.ats.arjuna.disableMultipleLastResourcesWarning

Returns:
true if warning is disabled, false otherwise.
    public boolean isDisableMultipleLastResourcesWarning()
    {
    }

    
Sets if the per-transaction warning on enlistment of multiple last resource is disabled or not.

Parameters:
disableMultipleLastResourcesWarning true to disable the warning, false otherwise.
    public void setDisableMultipleLastResourcesWarning(boolean disableMultipleLastResourcesWarning)
    {
        this. = disableMultipleLastResourcesWarning;
    }

    

Returns:
the version control tag of the source used, or "unknown"
    public String getBuildVersion()
    {
        return ConfigurationInfo.getVersion();
    }

    

Returns:
the build identification line indicating the os name and version and build date
    public String getBuildId()
    {
        return ConfigurationInfo.getBuildId();
    }
New to GrepCode? Check out our FAQ X