Switching to SBT 0.7.5.RC0 and now we can drop the ubly AkkaDeployClassLoader
This commit is contained in:
parent
62f312cd45
commit
a347bc3e5d
2 changed files with 4 additions and 36 deletions
|
|
@ -7,43 +7,10 @@ package akka.actor
|
|||
import java.io.File
|
||||
import java.net.{URL, URLClassLoader}
|
||||
import java.util.jar.JarFile
|
||||
import java.util.Enumeration
|
||||
|
||||
import akka.util.{Bootable, Logging}
|
||||
import akka.config.Config._
|
||||
|
||||
class AkkaDeployClassLoader(urls : List[URL], parent : ClassLoader) extends URLClassLoader(urls.toArray.asInstanceOf[Array[URL]],parent)
|
||||
{
|
||||
override def findResources(resource : String) = {
|
||||
val normalResult = super.findResources(resource)
|
||||
if(normalResult.hasMoreElements) normalResult else findDeployed(resource)
|
||||
}
|
||||
|
||||
def findDeployed(resource : String) = new Enumeration[URL]{
|
||||
private val it = getURLs.flatMap( listClassesInPackage(_,resource) ).iterator
|
||||
def hasMoreElements = it.hasNext
|
||||
def nextElement = it.next
|
||||
}
|
||||
|
||||
def listClassesInPackage(jar : URL, pkg : String) = {
|
||||
val f = new File(jar.getFile)
|
||||
val jf = new JarFile(f)
|
||||
try {
|
||||
val es = jf.entries
|
||||
var result = List[URL]()
|
||||
while(es.hasMoreElements)
|
||||
{
|
||||
val e = es.nextElement
|
||||
if(!e.isDirectory && e.getName.startsWith(pkg) && e.getName.endsWith(".class"))
|
||||
result ::= new URL("jar:" + f.toURI.toURL + "!/" + e)
|
||||
}
|
||||
result
|
||||
} finally {
|
||||
jf.close
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles all modules in the deploy directory (load and unload)
|
||||
*/
|
||||
|
|
@ -79,7 +46,7 @@ trait BootableActorLoaderService extends Bootable with Logging {
|
|||
log.debug("Loading dependencies [%s]", dependencyJars)
|
||||
val allJars = toDeploy ::: dependencyJars
|
||||
|
||||
new AkkaDeployClassLoader(allJars,Thread.currentThread.getContextClassLoader)
|
||||
new URLClassLoader(allJars.toArray,Thread.currentThread.getContextClassLoader)
|
||||
} else Thread.currentThread.getContextClassLoader)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#Project properties
|
||||
#Tue Nov 23 12:37:45 CET 2010
|
||||
project.organization=se.scalablesolutions.akka
|
||||
project.name=akka
|
||||
sbt.version=0.7.5.RC0
|
||||
project.version=1.0-SNAPSHOT
|
||||
scala.version=2.8.1
|
||||
sbt.version=0.7.4
|
||||
def.scala.version=2.7.7
|
||||
build.scala.versions=2.8.1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue