Skip to content

Commit

Permalink
Distributed Session Management #7529
Browse files Browse the repository at this point in the history
  • Loading branch information
rymsha committed Oct 22, 2019
1 parent 9293229 commit 5066785
Showing 1 changed file with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.enonic.xp.cluster.Cluster;
import com.enonic.xp.cluster.ClusterConfig;
import com.enonic.xp.cluster.ClusterHealth;
import com.enonic.xp.cluster.ClusterId;
import com.enonic.xp.cluster.ClusterNode;
import com.enonic.xp.cluster.ClusterNodes;
import com.enonic.xp.ignite.impl.config.ConfigurationFactory;
Expand All @@ -28,6 +31,7 @@

@Component(immediate = true, configurationPid = "com.enonic.xp.ignite")
public class IgniteCluster
implements Cluster
{
private Ignite ignite;

Expand Down Expand Up @@ -71,6 +75,7 @@ public void activate( final BundleContext context, final IgniteSettings igniteSe
thread.setContextClassLoader( classLoader );
}
context.registerService( Ignite.class, ignite, new Hashtable<>() );
// Register admin-client to use in e.g reporting
context.registerService( IgniteAdminClient.class, new IgniteAdminClientImpl( this.ignite ), new Hashtable<>() );
}

Expand All @@ -89,6 +94,48 @@ public void deactivate()
this.ignite.close();
}

@Override
public ClusterId getId()
{
return ClusterId.from( "ignite" );
}

@Override
public ClusterHealth getHealth()
{
return ClusterHealth.green();
}

@Override
public ClusterNodes getNodes()
{
try
{
return doGetNodes();
}
catch ( java.lang.IllegalStateException e )
{
return ClusterNodes.create().build();
}
}

@Override
public void enable()
{
// ignore
}

@Override
public void disable()
{
// ignore
}

@Override
public boolean isEnabled()
{
return this.reg != null;
}

private ClusterNodes doGetNodes()
{
Expand All @@ -104,7 +151,6 @@ private ClusterNodes doGetNodes()
return builder.build();
}


@SuppressWarnings("unused")
@Reference
public void setClusterConfig( final ClusterConfig clusterConfig )
Expand Down

0 comments on commit 5066785

Please sign in to comment.