Author |
Message |
|
This is very old thread.Please respond if issue is still not resolved.
Thanks
|
|
|
This is very old thread.Please respond if issue is still not resolved.
Thanks
|
|
|
This is very old thread.Please respond if issue is stil not resolved.
Thanks
|
|
|
To get clear idea about how to configure Ehcache.Please visit documentation given on Terracotta site:
http://www.terracotta.org/documentation/product-documentation-1page
|
|
|
If you do not want to use URL hard coded as in given sample code. You can set URL as a system property in Ehcache.xml and get the URL using CacheManager.
You can check the samle Ehcache.xml for more information.
|
|
|
Here is a sample code using ToolKit and ClusteredLock:
[code]
package Test;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;
import org.terracotta.api.*;
import org.terracotta.cluster.*;
import org.terracotta.locking.*;
public class ReadWriteLock {
/**
* @param args
*/
public static void main(String[] args) {
TerracottaClient client = new TerracottaClient("localhost:9510"); //start client
ClusteringToolkit toolkit = client.getToolkit(); //make the toolkit available to you application
ClusterInfo clusterinfo= toolkit.getClusterInfo();
System.out.println("Cluster Info" + toolkit.getClusterInfo());
ClusteredLock mylock = (ClusteredLock) toolkit.createLock("Mylock", LockType.WRITE); //create alock
mylock.lock();
try{
//Do some Clustered Operation.
}finally{
mylock.unlock();
}
}
}
[/code]
|
|
|
Please provide us the source code , configuration files and steps to reproduce the issue.
Thanks
|
|
|