org.mule.module.launcher.artifact
Interface ArtifactClassLoader
- All Superinterfaces:
- DisposableClassLoader, LocalResourceLocator
- All Known Subinterfaces:
- ApplicationClassLoader
- All Known Implementing Classes:
- AbstractArtifactClassLoader, CompositeApplicationClassLoader, MuleApplicationClassLoader, MuleSharedDomainClassLoader
public interface ArtifactClassLoader
- extends DisposableClassLoader, LocalResourceLocator
getArtifactName
String getArtifactName()
- Returns:
- the artifact unique identifier
findResource
URL findResource(String resource)
- Parameters:
resource - name of the resource to find.
- Returns:
- the resource URL, null if it doesn't exists.
getClassLoader
ClassLoader getClassLoader()
- ClassLoader is an abstract class. Not an interface.
There are parts of the code that requires a ClassLoader and others that requires an ArtifactClassLoader.
Ideally I would make ArtifactClassLoader implement ClassLoader interface but there's no such interface.
So if I have a method that requires a ClassLoader instance and an ArtifactClassLoader I would have to down cast and assume that it can be down casted or send two parameters, one for the ClassLoader and one for the ArtifactClassLoader:
public void doSomething(ArtifactClassLoader acl)
{
doSomething2(acl); //this requires an ArtifactClassLoader
doSomething3((ClassLoader)acl); //this requires a ClassLoader
}
public void doSomething(ArtifactClassLoader acl, ClassLoader cl)
{
doSomething2(acl); //this requires an ArtifactClassLoader
doSomething3(cl); //this requires a ClassLoader
}
To overcome that problem seems much better to have a method in ArtifactClassLoader that can actually return a ClassLoader instance:
public void doSomething(ArtifactClassLoader acl)
{
doSomething2(acl); //this requires an ArtifactClassLoader
doSomething3(acl.getDomainClassLoader()); //this requires a ClassLoader
}
- Returns:
- class loader to use for this artifact.
addShutdownListener
void addShutdownListener(ShutdownListener listener)
- Adds a shutdown listener to the class loader. This listener will be invoked synchronously right
before the class loader is disposed and closed.
Copyright © 2003–2014 MuleSoft, Inc.. All rights reserved.