Search in sources :

Example 1 with Cluster

use of lucee.runtime.type.scope.Cluster in project Lucee by lucee.

the class ConfigServerImpl method createClusterScope.

/*private static long _countx(ConfigWebImpl config) {
		 long count=0;
		count+=_count(config.getMappings());
		count+=_count(config.getCustomTagMappings());
		count+=_count(config.getComponentMappings());
		count+=_count(config.getFunctionMapping());
		count+=_count(config.getServerFunctionMapping());
		count+=_count(config.getTagMapping());
		count+=_count(config.getServerTagMapping());
		//count+=_count(((ConfigWebImpl)config).getServerTagMapping());
		return count;
	}*/
/*private static long _count(Mapping[] mappings) {
		 long count=0;
		for(int i=0;i<mappings.length;i++){
			count+=_count(mappings[i]);
		}
		return count;
	}*/
/*private static long _countx(Mapping mapping) {
		PCLCollection pcl = ((MappingImpl)mapping).getPCLCollection();
		return pcl==null?0:pcl.count();
	}*/
@Override
public Cluster createClusterScope() throws PageException {
    Cluster cluster = null;
    try {
        if (Reflector.isInstaneOf(getClusterClass(), Cluster.class)) {
            cluster = (Cluster) ClassUtil.loadInstance(getClusterClass(), ArrayUtil.OBJECT_EMPTY);
            cluster.init(this);
        } else if (Reflector.isInstaneOf(getClusterClass(), ClusterRemote.class)) {
            ClusterRemote cb = (ClusterRemote) ClassUtil.loadInstance(getClusterClass(), ArrayUtil.OBJECT_EMPTY);
            cluster = new ClusterWrap(this, cb);
        // cluster.init(cs);
        }
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
    return cluster;
}
Also used : ClusterWrap(lucee.runtime.type.scope.ClusterWrap) Cluster(lucee.runtime.type.scope.Cluster) FunctionLibException(lucee.transformer.library.function.FunctionLibException) PageException(lucee.runtime.exp.PageException) TagLibException(lucee.transformer.library.tag.TagLibException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) ExpressionException(lucee.runtime.exp.ExpressionException) ApplicationException(lucee.runtime.exp.ApplicationException) ClusterRemote(lucee.runtime.type.scope.ClusterRemote)

Example 2 with Cluster

use of lucee.runtime.type.scope.Cluster in project Lucee by lucee.

the class Admin method _doSetCluster.

private void _doSetCluster() throws PageException {
    Struct entries = Caster.toStruct(getObject("admin", action, "entries"));
    Struct entry;
    Iterator<Object> it = entries.valueIterator();
    Cluster cluster = pageContext.clusterScope();
    while (it.hasNext()) {
        entry = Caster.toStruct(it.next());
        cluster.setEntry(new ClusterEntryImpl(KeyImpl.getInstance(Caster.toString(entry.get(KeyConstants._key))), Caster.toSerializable(entry.get(KeyConstants._value, null), null), Caster.toLongValue(entry.get(KeyConstants._time))));
    }
    cluster.broadcast();
}
Also used : ClusterEntryImpl(lucee.runtime.type.scope.ClusterEntryImpl) Cluster(lucee.runtime.type.scope.Cluster) Struct(lucee.runtime.type.Struct)

Aggregations

Cluster (lucee.runtime.type.scope.Cluster)2 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 ApplicationException (lucee.runtime.exp.ApplicationException)1 ExpressionException (lucee.runtime.exp.ExpressionException)1 PageException (lucee.runtime.exp.PageException)1 Struct (lucee.runtime.type.Struct)1 ClusterEntryImpl (lucee.runtime.type.scope.ClusterEntryImpl)1 ClusterRemote (lucee.runtime.type.scope.ClusterRemote)1 ClusterWrap (lucee.runtime.type.scope.ClusterWrap)1 FunctionLibException (lucee.transformer.library.function.FunctionLibException)1 TagLibException (lucee.transformer.library.tag.TagLibException)1