Skip to content

Commit

Permalink
save work #7529
Browse files Browse the repository at this point in the history
  • Loading branch information
rymsha committed Oct 14, 2019
1 parent 6c44fcc commit f7c6527
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 110 deletions.
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Licenses used by Enonic XP (full license texts are provided after the list of li

Apache Ignite
Apache License 2.0
https://apacheignite.readme.io/v2.3/docs/license
https://apacheignite.readme.io/docs/license

Apache Tika
Apache License 2.0
Expand Down
1 change: 1 addition & 0 deletions gradle/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ configurations {
ext {
felixVersion = '6.0.1'
jettyVersion = '9.4.21.v20190926'
igniteVersion = '2.7.6'
}

dependencies {
Expand Down
5 changes: 2 additions & 3 deletions modules/core/core-ignite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ apply from: "$rootDir/gradle/osgi.gradle"

dependencies {
compile project( ':core:core-api' )
compile 'org.apache.ignite:ignite-core:2.3.0'
compile 'org.apache.ignite:ignite-osgi:2.3.0'
compile 'javax.cache:cache-api:1.0.0'
compile "org.apache.ignite:ignite-core:${igniteVersion}"
compile "org.apache.ignite:ignite-osgi:${igniteVersion}"
testCompile project( path: ':core:core-api', configuration: 'testOutput' )
}

Expand Down
11 changes: 0 additions & 11 deletions modules/repack/repack-javax-cache-api/build.gradle

This file was deleted.

3 changes: 1 addition & 2 deletions modules/runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ addBundle( project( ':repack:repack-elasticsearch' ), 8 )
addBundle( project( ':repack:repack-resteasy' ), 8 )
addBundle( project( ':repack:repack-attoparser' ), 8 )
addBundle( project( ':repack:repack-okhttp' ), 8 )
addBundle( project( ':repack:repack-javax-cache-api' ), 8 )
addBundle( 'javax.cache:cache-api:1.1.1' , 8 )
addBundle( 'org.apache.ignite:ignite-core:2.3.0', 8 )
addBundle( 'org.apache.ignite:ignite-osgi:2.3.0', 8 )
addBundle( 'org.apache.ignite:ignite-web:2.3.0', 8 )
Expand All @@ -87,7 +87,6 @@ addBundle( project( ':core:core-image' ), 22 )
addBundle( project( ':core:core-export' ), 22 )
addBundle( project( ':core:core-mail' ), 22 )
addBundle( project( ':core:core-elasticsearch' ), 22 )
//TODO Java10
//addBundle( project( ':core:core-ignite' ), 22 )
addBundle( project( ':core:core-content' ), 22 )
addBundle( project( ':core:core-site' ), 22 )
Expand Down
6 changes: 2 additions & 4 deletions modules/web/web-session/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ apply from: "$rootDir/gradle/osgi.gradle"
dependencies {
compile project( ':web:web-api' )
compile "org.eclipse.jetty:jetty-server:${jettyVersion}"
compile 'org.apache.ignite:ignite-core:2.3.0'
compile 'org.apache.ignite:ignite-osgi:2.3.0'
compile 'org.apache.ignite:ignite-web:2.3.0'
compile 'javax.cache:cache-api:1.0.0'
compile "org.apache.ignite:ignite-core:${igniteVersion}"
compile "org.apache.ignite:ignite-osgi:${igniteVersion}"
testCompile project( path: ':web:web-api', configuration: 'testOutput' )
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public final class IgniteSessionDataStore

private Ignite ignite;

private IgniteCache<String, SessionDataWrapper> igniteCache;
private IgniteCache<String, SessionData> igniteCache;

private ConcurrentHashMap<String, SessionData> defaultCache = new ConcurrentHashMap<>();

Expand Down Expand Up @@ -93,15 +93,15 @@ public SessionData load( String id )

public SessionData doLoad( final String cacheKey )
{
final IgniteCache<String, SessionDataWrapper> igniteCache = this.igniteCache;
final IgniteCache<String, SessionData> igniteCache = this.igniteCache;
if ( igniteCache == null )
{
return defaultCache.get( cacheKey );
}
else
{
final SessionDataWrapper sessionDataWrapper = igniteCache.get( cacheKey );
return sessionDataWrapper == null ? null : sessionDataWrapper.getSessionData();
final SessionData sessionDataWrapper = igniteCache.get( cacheKey );
return sessionDataWrapper == null ? null : sessionDataWrapper;
}
}

Expand All @@ -110,7 +110,7 @@ public boolean delete( String id )
throws Exception
{
final String cacheKey = getCacheKey( id );
final IgniteCache<String, SessionDataWrapper> igniteCache = this.igniteCache;
final IgniteCache<String, SessionData> igniteCache = this.igniteCache;
if ( igniteCache == null )
{
return defaultCache.remove( cacheKey ) != null;
Expand All @@ -133,18 +133,18 @@ public void doStore( String id, SessionData data, long lastSaveTime )
throws Exception
{
final String cacheKey = getCacheKey( id );
final IgniteCache<String, SessionDataWrapper> igniteCache = this.igniteCache;
final IgniteCache<String, SessionData> igniteCache = this.igniteCache;
if ( igniteCache == null )
{
defaultCache.put( cacheKey, data );
}
else
{
asyncPut( cacheKey, new SessionDataWrapper( data ), webSessionConfig.write_timeout() );
asyncPut( cacheKey, data, webSessionConfig.write_timeout() );
}
}

private void asyncPut( final String cacheKey, final SessionDataWrapper data, final int timeoutMillis )
private void asyncPut( final String cacheKey, final SessionData data, final int timeoutMillis )
throws IgniteException
{
final IgniteFuture<Void> future = igniteCache.putAsync( cacheKey, data );
Expand Down Expand Up @@ -280,4 +280,4 @@ public synchronized void removeIgnite( final Ignite ignite )
this.ignite = null;
this.igniteCache = null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.configuration.CacheConfiguration;
import org.eclipse.jetty.server.session.SessionData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

class SessionCacheConfigFactory
public class SessionCacheConfigFactory
{
private final static Logger LOG = LoggerFactory.getLogger( SessionCacheConfigFactory.class );

static CacheConfiguration<String, SessionDataWrapper> create( final String cacheName, final WebSessionConfig config )
public static CacheConfiguration<String, SessionData> create( final String cacheName, final WebSessionConfig config )
{
final CacheConfiguration<String, SessionDataWrapper> cacheConfig = new CacheConfiguration<>();
final CacheConfiguration<String, SessionData> cacheConfig = new CacheConfiguration<>();

cacheConfig.setAtomicityMode( CacheAtomicityMode.ATOMIC );
cacheConfig.setWriteSynchronizationMode( getWriteSyncMode( config.write_sync_mode() ) );
Expand All @@ -27,22 +27,22 @@ static CacheConfiguration<String, SessionDataWrapper> create( final String cache

private static CacheWriteSynchronizationMode getWriteSyncMode( final String writeSyncMode )
{
switch ( writeSyncMode.toLowerCase() )
String writeSyncModeLowercase = writeSyncMode.toLowerCase();
switch ( writeSyncModeLowercase )
{
case "full":
return CacheWriteSynchronizationMode.FULL_SYNC;

case "primary":
return CacheWriteSynchronizationMode.PRIMARY_SYNC;
case "async":
return CacheWriteSynchronizationMode.FULL_ASYNC;
default:
LOG.warn( "Unknown write sync mode: " + writeSyncMode.toLowerCase() + ", using default: " + "FULL_SYNC" );
LOG.warn( "Unknown write sync mode: " + writeSyncModeLowercase + ", using default: " + "full" );
return CacheWriteSynchronizationMode.FULL_SYNC;
}
}

private static void setCacheMode( final WebSessionConfig config, final CacheConfiguration<String, SessionDataWrapper> cacheConfig )
private static void setCacheMode( final WebSessionConfig config, final CacheConfiguration<String, SessionData> cacheConfig )
{
switch ( config.cache_mode().toLowerCase() )
{
Expand All @@ -61,13 +61,4 @@ private static void setCacheMode( final WebSessionConfig config, final CacheConf
cacheConfig.setCacheMode( CacheMode.REPLICATED );
}
}

private static void setEvictionPolicy( final WebSessionConfig config, final CacheConfiguration<String, SessionDataWrapper> cacheConfig )
{
final LruEvictionPolicy evictPlc = new LruEvictionPolicy();
evictPlc.setMaxSize( config.eviction_max_size() );

cacheConfig.setEvictionPolicy( evictPlc );
}

}
Loading

0 comments on commit f7c6527

Please sign in to comment.