Context and Deployment Descriptor > The Context Services > Synchronization Strategy

The synchronization strategy, named after the strategy design pattern, is defined by the class IlSynchronizationStrategy. It makes it possible to access shared resources simultaneously with a choice of synchronization schemes.

The IlSynchronizationStrategy class provides five methods to manage synchronized access to resources:

How to Use the Synchronization Strategy Through the API

The following code extract shows you how you can use the synchronization strategy in your application:

IlpContext context = IltSystem.GetDefaultContext();
IlSynchronizationStrategy strategy = context.getSynchronizationStrategy();
Runnable task = new Runnable() {
  public void run() {
  ... 
  }
}
IlpNetwork networkComponent = new IlpNetwork(context);
strategy.writeLock(task, networkComponent.getModel());

JViews TGO provides two standard implementations of this service:

How to Customize the Synchronization Strategy Through the Deployment Descriptor

The default synchronization strategy service can be customized through the deployment descriptor file using the tag <synchronizationStrategy>.

[<synchronizationStrategy type="application"|"servlet"/>]

where type:

The following code extract shows you how you can customize the synchronization strategy through the API:

How to Customize the Synchronization Strategy Through the API

The only thing you can do through the API is to change the synchronization strategy used in the context.

IlpDefaultContext context = ... 
IlSynchronizationStrategy strategy = new IlSwingThreadSyncStrategy();
context.addService(IlSynchronizationStrategy.class, strategy);