private void doTestInvalidate(boolean useClustering) throws Exception { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); // No file system docBase required Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "bug56578", new Bug56578Servlet()); ctx.addServletMapping("/bug56578", "bug56578"); if (useClustering) { tomcat.getEngine().setCluster(new SimpleTcpCluster()); ctx.setDistributable(true); ctx.setManager(ctx.getCluster().createManager("")); } tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/bug56578"); Assert.assertEquals("PASS", res.toString()); }
private void doTestInvalidate(boolean useClustering) throws Exception { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); // Must have a real docBase - just use temp Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); Tomcat.addServlet(ctx, "bug56578", new Bug56578Servlet()); ctx.addServletMapping("/bug56578", "bug56578"); if (useClustering) { tomcat.getEngine().setCluster(new SimpleTcpCluster()); ctx.setDistributable(true); ctx.setManager(ctx.getCluster().createManager("")); } tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/bug56578"); Assert.assertEquals("PASS", res.toString()); }
public SimpleTomEETcpCluster(final SimpleTcpCluster from) { clusterListeners.addAll(Arrays.asList(from.findClusterListeners())); setClusterName(from.getClusterName()); setContainer(from.getContainer()); setNotifyLifecycleListenerOnFailure(from.isNotifyLifecycleListenerOnFailure()); setChannelSendOptions(from.getChannelSendOptions()); setChannelStartOptions(from.getChannelStartOptions()); setHeartbeatBackgroundEnabled(from.isHeartbeatBackgroundEnabled()); setChannel(from.getChannel()); getManagers().putAll(from.getManagers()); setManagerTemplate(from.getManagerTemplate()); setClusterDeployer(from.getClusterDeployer()); for (final Valve valve : from.getValves()) { addValve(valve); } }
private void manageCluster(final Cluster cluster) { if (cluster == null || cluster instanceof SimpleTomEETcpCluster) { return; } Cluster current = cluster; if (cluster instanceof SimpleTcpCluster) { final Container container = cluster.getContainer(); current = new SimpleTomEETcpCluster((SimpleTcpCluster) cluster); container.setCluster(current); } if (current instanceof CatalinaCluster) { final CatalinaCluster haCluster = (CatalinaCluster) current; TomEEClusterListener listener = SystemInstance.get().getComponent(TomEEClusterListener.class); if (listener == null) { listener = new TomEEClusterListener(); SystemInstance.get().setComponent(TomEEClusterListener.class, listener); } haCluster.addClusterListener(listener); // better to be a singleton clusters.add(haCluster); } }
public static boolean registerDefaultCluster(SimpleTcpCluster cluster) { try { initDefaultCluster(); ObjectName clusterName = getDefaultClusterName(cluster); if (!getMBeanServer().isRegistered(clusterName)) { getMBeanServer().registerMBean(getManagedBean(cluster), clusterName); } return true; }catch ( Exception x ) { log.warn("Unable to register default cluster implementation with JMX",x); return false; } }
public static boolean unregisterDefaultCluster(SimpleTcpCluster cluster) { try { ObjectName clusterName = getDefaultClusterName(cluster); if (getMBeanServer().isRegistered(clusterName)) { getMBeanServer().unregisterMBean(clusterName); } return true; }catch ( Exception x ) { log.warn("Unable to unregister default cluster implementation with JMX",x); return false; } }
private static ObjectName getDefaultClusterName(SimpleTcpCluster cluster) throws Exception { String domain = getMBeanServer().getDefaultDomain(); String type = ":type="; String clusterType= type+"Cluster"; if (cluster.getContainer() instanceof StandardHost) { domain = ((StandardHost) cluster.getContainer()).getDomain(); clusterType += ",host=" + cluster.getContainer().getName(); } else { if (cluster.getContainer() instanceof StandardEngine) { domain = ((StandardEngine) cluster.getContainer()).getDomain(); } } ObjectName clusterName = new ObjectName(domain + clusterType); return clusterName; }
public static boolean registerDefaultCluster(SimpleTcpCluster cluster) { try { initDefaultCluster(); ObjectName clusterName = getDefaultClusterName(cluster); if (!getMBeanServer().isRegistered(clusterName)) { getMBeanServer().registerMBean(getManagedBean(cluster), clusterName); } return true; } catch (Exception x) { log.warn("Unable to register default cluster implementation with JMX", x); return false; } }
public static boolean unregisterDefaultCluster(SimpleTcpCluster cluster) { try { ObjectName clusterName = getDefaultClusterName(cluster); if (getMBeanServer().isRegistered(clusterName)) { getMBeanServer().unregisterMBean(clusterName); } return true; } catch (Exception x) { log.warn("Unable to unregister default cluster implementation with JMX", x); return false; } }
private static ObjectName getDefaultClusterName(SimpleTcpCluster cluster) throws Exception { String domain = getMBeanServer().getDefaultDomain(); String type = ":type="; String clusterType = type + "Cluster"; if (cluster.getContainer() instanceof StandardHost) { domain = ((StandardHost) cluster.getContainer()).getDomain(); clusterType += ",host=" + cluster.getContainer().getName(); } else { if (cluster.getContainer() instanceof StandardEngine) { domain = ((StandardEngine) cluster.getContainer()).getDomain(); } } ObjectName clusterName = new ObjectName(domain + clusterType); return clusterName; }
protected static void initDefaultCluster() { initMetaData(SimpleTcpCluster.class); initMetaData(FarmWarDeployer.class); //not functional yet }
protected static void initDefaultCluster() { initMetaData(SimpleTcpCluster.class); initMetaData(FarmWarDeployer.class); // not functional yet }
protected static void initDefaultCluster() { initMetaData(SimpleTcpCluster.class); initMetaData(DeltaManager.class); initMetaData(FarmWarDeployer.class); //not functional yet initMetaData(ClusterSingleSignOn.class); //not functional yet }