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 configuration properties for the objectstore and various implementations thereof.

Author(s):
Jonathan Halliday (jonathan.halliday@redhat.com)
 
 @PropertyPrefix(prefix = "com.arjuna.ats.arjuna.objectstore.")
 {
     private volatile String localOSRoot = "defaultStore";
     private volatile String objectStoreDir = System.getProperty("user.dir") + . + "ObjectStore";
     private volatile boolean objectStoreSync = true;
     private volatile String objectStoreType = ShadowNoFileLockStore.class.getName();
     private volatile int hashedDirectories = .;
     private volatile boolean transactionSync = true;
 
     private volatile boolean scanZeroLengthFiles = false;
 
     private volatile int share = .;
     private volatile int hierarchyRetry = 100;
     private volatile int hierarchyTimeout = 100;
 
     @FullPropertyName(name = "com.arjuna.ats.internal.arjuna.objectstore.cacheStore.size")
     private volatile int cacheStoreSize = 10240;  // size in bytes
     @FullPropertyName(name = "com.arjuna.ats.internal.arjuna.objectstore.cacheStore.sync")
     private volatile boolean cacheStoreSync = false;
     @FullPropertyName(name = "com.arjuna.ats.internal.arjuna.objectstore.cacheStore.removedItems")
     private volatile int cacheStoreRemovedItems = 256;
     @FullPropertyName(name = "com.arjuna.ats.internal.arjuna.objectstore.cacheStore.scanPeriod")
     private volatile int cacheStoreScanPeriod = 120000;
     @FullPropertyName(name = "com.arjuna.ats.internal.arjuna.objectstore.cacheStore.workItems")
     private volatile int cacheStoreWorkItems = 100;
     @FullPropertyName(name = "com.arjuna.ats.internal.arjuna.objectstore.cacheStore.hash")
     private volatile int cacheStoreHash = 128;
 
     @FullPropertyName(name = "com.arjuna.ats.arjuna.coordinator.transactionLog.synchronousRemoval")
     private volatile boolean synchronousRemoval = true;
     @FullPropertyName(name = "com.arjuna.ats.arjuna.coordinator.transactionLog.size")
     private volatile long txLogSize = 10 * 1024 * 1024;  // default maximum log txLogSize in bytes;
     @FullPropertyName(name = "com.arjuna.ats.arjuna.coordinator.transactionLog.purgeTime")
     private volatile long purgeTime = 100000; // in milliseconds
 
     private volatile boolean androidDirCheck = false;
     
 	private volatile String jdbcAccess;
 
 	private volatile String tablePrefix;
 
 	private volatile boolean dropTable;
 	
 	private volatile boolean createTable = true;
    
    
Returns the maximum allowed size, in bytes, of the cache store's in-memory cache. Default: 10240 bytes Equivalent deprecated property: com.arjuna.ats.internal.arjuna.objectstore.cacheStore.size

Returns:
the memory cache size in bytes.
 
     public int getCacheStoreSize()
     {
         return ;
     }

    
Sets the maximum size, in bytes, of the in-memory object state cache.

Parameters:
cacheStoreSize the maximum cache size in bytes.
    public void setCacheStoreSize(int cacheStoreSize)
    {
        this. = cacheStoreSize;
    }

    
Returns true if writes to the objectstore should include a disk sync. Unlikely to be worthwile since the store caches state in memory anyhow. Default: false Equivalent deprecated property: com.arjuna.ats.internal.arjuna.objectstore.cacheStore.sync

Returns:
true if writes should be synched to disk, false otherwise.
    public boolean isCacheStoreSync()
    {
        return ;
    }

    
Sets if writes to the store should be synched to disk or not.

Parameters:
cacheStoreSync true to enable syncing, false to disable.
    public void setCacheStoreSync(boolean cacheStoreSync)
    {
        this. = cacheStoreSync;
    }

    
Returns the maximum number of removed items that may be held in the cache before being purged. Default: 256 Equivalent deprecated property: com.arjuna.ats.internal.arjuna.objectstore.cacheStore.removedItems

Returns:
the maximum number of removed items in the cache.
    public int getCacheStoreRemovedItems()
    {
        return ;
    }

    
Sets the maximum number of removed items that may be held in the cache before being purged.

Parameters:
cacheStoreRemovedItems teh maximun number of items.
    public void setCacheStoreRemovedItems(int cacheStoreRemovedItems)
    {
        this. = cacheStoreRemovedItems;
    }

    
Returns the interval on which the cache will wake and process outstanding work. Default: 120000 milliseconds Equivalent deprecated property: com.arjuna.ats.internal.arjuna.objectstore.cacheStore.scanPeriod

Returns:
the work interval of the cache, in milliseconds.
    public int getCacheStoreScanPeriod()
    {
        return ;
    }

    
Sets the interval on which the cache will process outstanding work, in milliseconds.

Parameters:
cacheStoreScanPeriod the sleep duration, in milliseconds.
    public void setCacheStoreScanPeriod(int cacheStoreScanPeriod)
    {
        this. = cacheStoreScanPeriod;
    }

    
Returns the maximum number of outstanding writes that may be held in the cache. Default: 100 Equivalent deprecated property: com.arjuna.ats.internal.arjuna.objectstore.cacheStore.workItems

Returns:
the maximum number of outstanding writes in the cache.
    public int getCacheStoreWorkItems()
    {
        return ;
    }

    
Sets the maximum number of outstanding writes that may be held in the cache.

Parameters:
cacheStoreWorkItems the maximum number of outstnading writes.
    public void setCacheStoreWorkItems(int cacheStoreWorkItems)
    {
        this. = cacheStoreWorkItems;
    }

    
Returns the number of hash buckets used for the cache work queue. Default: 128 Equivalent deprecated property: com.arjuna.ats.internal.arjuna.objectstore.cacheStore.hash

Returns:
the number of hash buckets used to store the cache state.
    public int getCacheStoreHash()
    {
        return ;
    }

    
Sets the number of hash buskets used to store the cache work queue.

Parameters:
cacheStoreHash the number of hash buckets.
    public void setCacheStoreHash(int cacheStoreHash)
    {
        this. = cacheStoreHash;
    }


    
Returns the local ObjectStore root directory name. This should be a path element, not a complete path. Default: "defaultStore" Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.localOSRoot

Returns:
the local ObjectStore root directory name.
    public String getLocalOSRoot()
    {
        return ;
    }

    
Sets the local ObjectStore root directory name. This shold be a path element, not a complete path.

Parameters:
localOSRoot the directory name.
    public void setLocalOSRoot(String localOSRoot)
    {
        this. = localOSRoot;
    }

    
Returns the ObjectStore directory path. Default: {user.dir}/ObjectStore Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.objectStoreDir

Returns:
the ObjectStore directory path.
    public String getObjectStoreDir()
    {
        if (Utility.isAndroid() && !)
        {
            try
            {
                /*
                 * Use reflection so we can build this in an environment that does
                 * not have the various Android libraries available.
                 */
                     
                Class<?> instance = Class.forName("android.os.Environment");
                
                Method[] mthds = instance.getDeclaredMethods();
                Method m = null;
                
                for (int i = 0; (i < mthds.length) && (m == null); i++)
                {
                    if ("getExternalStorageDirectory".equals(mthds[i].getName()))
                        m = mthds[i];
                }
                
                 = ((Filem.invoke(null)).toString() + . + "ObjectStore";
                
                 = true;
            }
            catch (final Throwable ex)
            {
                ex.printStackTrace();
            }
        }
        
        return ;
    }

    
Sets the ObjectStore directory path.

Parameters:
objectStoreDir the directory path.
    public void setObjectStoreDir(String objectStoreDir)
    {
        this. = objectStoreDir;
    }

    
Returns true if ObjectStore operations should be synched to disk. Note that this value may be overridden by store implementation specific configuration. See also: isTransactionSync Default: true Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.objectStoreSync

Returns:
true for synched operations, false otherwise.
    public boolean isObjectStoreSync()
    {
        return ;
    }

    
Sets if ObjectStore operations should be synched to disk or not. Caution: Disabling this may be lead to non-ACID transaction behaviour.

Parameters:
objectStoreSync true to sunc to disk, false to skip synching.
    public void setObjectStoreSync(boolean objectStoreSync)
    {
        this. = objectStoreSync;
    }

    
Returns the fully qualified class name for the ObjectStore implementation. Default: "com.arjuna.ats.internal.arjuna.objectstore.ShadowNoFileLockStore" Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.objectStoreType

Returns:
the fully qualified class name of the ObjectStore implementation.
    public String getObjectStoreType()
    {
        return ;
    }

    
Sets the symbolic name of the ObjectStore implementation.

Parameters:
objectStoreType the symbolic name of the implementation.
    public void setObjectStoreType(String objectStoreType)
    {
        this. = objectStoreType;
    }

    
Returns the number of directories over which the ObjectStore contents will be distributed. Splitting the contents is important for performance on some file systems, as it reduces chain length (number of items in a directory) and directory lock contention. Default: 255 Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.hashedDirectories

Returns:
the number of directories over which to distribute the store.
    public int getHashedDirectories()
    {
        return ;
    }

    
Sets the number of directories over which the ObjectStore will be split.

Parameters:
hashedDirectories the number of directories.
    public void setHashedDirectories(int hashedDirectories)
    {
        this. = hashedDirectories;
    }

    
Returns true if transaction log operations should be synched to disk. Default: true Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.transactionSync

Returns:
true if operations should be forcedto disk, false otherwise.
    public boolean isTransactionSync()
    {
        return ;
    }

    
Sets if transaction log operations should be synched to disk or not. Caution: Disabling this may be lead to non-ACID transaction behaviour.

Parameters:
transactionSync true to enable synching, false to disable.
    public void setTransactionSync(boolean transactionSync)
    {
        this. = transactionSync;
    }

    
Returns true if zero length files should be returned by a recovery scan. Default: false

Returns:
true if scan results should include zero length files, false if they should be excluded.
    public boolean isScanZeroLengthFiles()
    {
        return ;
    }

    
Sets if zero length files should be returned by a recovery scan.

Parameters:
scanZeroLengthFiles true to include zero length files in scan results, false to exclude them.
    public void setScanZeroLengthFiles(boolean scanZeroLengthFiles)
    {
        this. = scanZeroLengthFiles;
    }

    
Returns the share mode for the ObjectStore, i.e., is this being shared between VMs? Default: ObjectStore.OS_UNKNOWN Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.share

Returns:
the default share mode.
    public int getShare()
    {
        return ;
    }

    
Sets the share mode of the ObjectStore

Parameters:
share a valid share mode.
    public void setShare(int share)
    {
        this. = share;
    }

    
Returns the maximum number of attempts which may be made to create a file path in the store. Default: 100 Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.hierarchyRetry

Returns:
the maximum number of attempts to create a nested directory tree.
    public int getHierarchyRetry()
    {
        return ;
    }

    
Sets the maximum number of attempts which may be made to create a direcory tree in the store.

Parameters:
hierarchyRetry the maximum number of file creation attempts.
    public void setHierarchyRetry(int hierarchyRetry)
    {
        this. = hierarchyRetry;
    }

    
Returns the time in milliseconds to wait between file creation retries. Default: 100 milliseconds. Equivalent deprecated property: com.arjuna.ats.arjuna.objectstore.hierarchyTimeout

Returns:
the time to wait before retrying a failed file creation, in milliseconds.
    public int getHierarchyTimeout()
    {
        return ;
    }

    
Sets the time in milliseconds to wait between file creation retries.

Parameters:
hierarchyTimeout the wait time in milliseconds.
    public void setHierarchyTimeout(int hierarchyTimeout)
    {
        this. = hierarchyTimeout;
    }

    
Returns true if the LogStore should write removal records synchronously. Disabling this may increase performance at the cost of recovery complexity. Default: true Equivalent deprecated property: com.arjuna.ats.arjuna.coordinator.transactionLog.synchronousRemoval

Returns:
true for synchronous removals, false for buffered (asynchronous) operation.
    public boolean isSynchronousRemoval()
    {
        return ;
    }

    
Sets if the LogStore should write removal records synchronously or not.

Parameters:
synchronousRemoval true for synchronous operation, false for asynchronous.
    public void setSynchronousRemoval(boolean synchronousRemoval)
    {
        this. = synchronousRemoval;
    }

    
Returns the default size of the LogStore file, in bytes. Default: 10MB Equivalent deprecated property: com.arjuna.ats.arjuna.coordinator.transactionLog.txLogSize

Returns:
the default file size for the LogStore, in bytes.
    public long getTxLogSize()
    {
        return ;
    }

    
Sets the default size of the LogStore, in bytes.

Parameters:
txLogSize the default file size, in bytes.
    public void setTxLogSize(long txLogSize)
    {
        this. = txLogSize;
    }

    
Returns the purge interval for the LogStore, in milliseconds. Default: 100000 milliseconds Equivalent deprecated property: com.arjuna.ats.arjuna.coordinator.transactionLog.purgeTime

Returns:
the purge interval in milliseconds.
    public long getPurgeTime()
    {
        return ;
    }

    
Sets the purge interval for the LogStore, in milliseconds.

Parameters:
purgeTime the purge interval in milliseconds.
    public void setPurgeTime(long purgeTime)
    {
        this. = purgeTime;
    }

Returns an instance of a class implementing JDBCAccess.

Returns:
a JDBCAccess implementation instance, or null.
	public String getJdbcAccess() {
		return ;
	}

Sets the instance of JDBCAccess

Parameters:
instance an Object that implements JDBCAccess, or null.
	public void setJdbcAccess(String connectionDetails) {
		 = connectionDetails;
	}

Get the table prefix

Returns:
The prefix to apply to the table
	public String getTablePrefix() {
		return ;
	}

Set the table prefix

Parameters:
tablePrefix A prefix to use on the tables
	public void setTablePrefix(String tablePrefix) {
		this. = tablePrefix;
	}

Should the store drop the table

Returns:
Whether to drop the table
	public boolean getDropTable() {
		return ;
	}

Set whether to drop the table.

Parameters:
dropTable Drop the table
	public void setDropTable(boolean dropTable) {
		this. = dropTable;
	}

Should the store create the table

Returns:
Whether to create the table
	public boolean getCreateTable() {
		return ;
	}

Set whether to create the table.

Parameters:
createTable Create the table
	public void setCreateTable(boolean createTable) {
		this. = createTable;
	}
New to GrepCode? Check out our FAQ X