Skip to content

Instantly share code, notes, and snippets.

View karanmalhi's full-sized avatar

Karan Singh Malhi karanmalhi

  • MuleSoft
  • San Francisco
View GitHub Profile
@karanmalhi
karanmalhi / CustomAlertResponse.groovy
Last active August 29, 2015 14:20
How to take custom action on raised alert
package com.mulesoft.tcat
import org.mule.galaxy.event.annotation.Async
import org.mule.galaxy.event.annotation.BindToEvent
import org.mule.galaxy.event.annotation.OnEvent
import org.mule.galaxy.event.EventManager;
import org.springframework.context.ApplicationContext;
@BindToEvent("com.mulesoft.console.alert.RaisedAlertEvent")
public class ScriptExecutor {
def ApplicationContext applicationContext;
def EventManager eventManager;
@karanmalhi
karanmalhi / DeploymentInterceptor.groovy
Last active August 29, 2015 14:20
Deployment Interceptor
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import com.mulesoft.tcat.DeploymentInterceptor;
import com.mulesoft.tcat.Application;
import com.mulesoft.tcat.Deployment;
import com.mulesoft.tcat.DeploymentInterceptor;
import com.mulesoft.tcat.DeploymentVersion;
import com.mulesoft.tcat.Server;
@karanmalhi
karanmalhi / intellij_error
Created August 31, 2012 13:32
intellij error
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -ea -Didea.launcher.port=7534 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 11.app/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA 11.app/lib/idea_rt.jar:/Applications/IntelliJ IDEA 11.app/plugins/junit/lib/junit-rt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Content
@karanmalhi
karanmalhi / gist:2765027
Created May 21, 2012 22:15
deploymentStatus
private DeploymentStatus getDeploymentStatus(DeploymentAction latest) {
DeploymentStatus status;
if (Action.DELETE.equals(latest.getAction())) {
status = DeploymentStatus.DELETING;
} else {
boolean inProcess = false;
int failCount = 0;
// if size is 0, that means we do not have any status yes, a typical indication that the deployment on servers has not started yet.
if (latest.getStatuses().size() == 0) {
// the deployment is still in progress, i.e. about to start
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<distributable/>
@karanmalhi
karanmalhi / index.jsp
Created December 6, 2011 22:04
A simple index.jsp file which shows some session information
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Apache Tomcat Examples</TITLE>
<META http-equiv=Content-Type content="text/html">
</HEAD>
<BODY>
<h3>Session ID = <%=session.getId()%></h3>
<h3>Creation Time = <%=session.getCreationTime()%></h3>
</BODY></HTML>
@karanmalhi
karanmalhi / isapi_redirect.properties
Created December 6, 2011 21:24
The properties file which ties everything together.
#tomcat will be the name of the virtual directory under IIS
extension_uri=/tomcat/isapi_redirect.dll
#location of the log file
log_file=C:\inetpub\isapi\logs\isapi_redirect.log
log_level=debug
#location of worker.properties
worker_file=C:\inetpub\isapi\conf\worker.properties
#location of uriworkermap.properties
worker_mount_file=C:\inetpub\isapi\conf\uriworkermap.properties
@karanmalhi
karanmalhi / uriworkermap.properties
Created December 6, 2011 21:21
uriworkermap.properties to map URL Path patterns to workers
#/foo and /foo/* are both mapped to balancer worker
/foo|/*=balancer
#/jkstatus is mapped to the stats worker
/jkstatus/=stats
@karanmalhi
karanmalhi / worker.properties
Created December 6, 2011 21:18
Used to configure workers
#The list of workers
worker.list=balancer,stats
#The template contains default values. Each worker will inherit
#these values and override the port
# the worker type
worker.template.type=ajp13
#This could also be an IP address. Since all Tomcat instances
#and IIS are installed on the same host, hence "localhost"
@karanmalhi
karanmalhi / gist:1230754
Created September 20, 2011 23:45
Can't assign requeted address
SEVERE: Error starting endpoint
java.net.BindException: Can't assign requested address /172.16.10.170:60001
at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:549)
at org.apache.tomcat.util.net.JIoEndpoint.start(JIoEndpoint.java:565)
at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:203)
at org.apache.catalina.connector.Connector.start(Connector.java:1095)
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:277)
at com.mulesoft.tcat.agent.web.AgentServlet.doCreateSecureConnector(AgentServlet.java:225)
at com.mulesoft.common.agent.servlet.AbstractAgentServlet.createSecureConnector(AbstractAgentServlet.java:245)
at com.mulesoft.common.agent.servlet.AbstractAgentServlet.pair(AbstractAgentServlet.java:129)