scan interval

Desabilitando Hot Deployment no JBoss AS 7.1

Postado em Atualizado em

Olá amigos,

O JBoss AS 7 (como versões anteriores) possui um recurso chamado “deployment scanner service”. O deployment scanner é responsável pelo conhecido Hot Deployment (deploy com o servidor em execução). O problema é que o deployment scanner consome uma quantidade relevante de recursos já que ele fica varrendo o diretório JBOSS_HOME/standalone/deployments periódicamente em busca de novas aplicações para serem deployadas.

Esse intervalo é definido na tag scan-interval=”5000″ que por padrão é 5 segundos. Para alterar por exemplo para 60 segundos vá até o subsystem deployment-scanner e defina o novo valor:

<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
   <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="60000" deployment-timeout="600000"/>
</subsystem>

Caso realmente deseje desabilitar basta remover o subsystem deployment-scanner (opção não recomendada) <subsystem xmlns=”urn:jboss:domain:deployment-scanner:1.1″>.

Outra maneira (recomendada) é desabilitar o deploy das aplicações “exploded” e “zipped” (.WAR por exemplo):

<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
    <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000" auto-deploy-zipped="false" auto-deploy-exploded="false" deployment-timeout="600000"/>
</subsystem>

Você deve estar se perguntando: OK, desabilitei tudo! Como o JBoss vai saber que a aplicação deve ser deployada? Simples basta renomear o arquivo deployado por exemplo minhaapp.war para minhaapp.war.dodeploy e pronto! A aplicação será finalmente deployada.

Para saber mais sobre as “marcações” dos arquivos deployados no JBoss AS 7, aconselho a leitura do JBOSS_HOME/standalone/deployments/README.txt. Veja abaixo uma parte do conteúdo:

————————————————————————————-

.dodeploy — Placed by the user to indicate that the given content should
be deployed into the runtime (or redeployed if already
deployed in the runtime.)

.skipdeploy — Disables auto-deploy of the content for as long as the file
is present. Most useful for allowing updates to exploded
content without having the scanner initiate redeploy in the
middle of the update. Can be used with zipped content as
well, although the scanner will detect in-progress changes
to zipped content and wait until changes are complete.

.isdeploying — Placed by the deployment scanner service to indicate that it
has noticed a .dodeploy file or new or updated auto-deploy
mode content and is in the process of deploying the content.
This marker file will be deleted when the deployment process
completes.

.deployed — Placed by the deployment scanner service to indicate that the
given content has been deployed into the runtime. If an end
user deletes this file, the content will be undeployed.

.failed — Placed by the deployment scanner service to indicate that the
given content failed to deploy into the runtime. The content
of the file will include some information about the cause of
the failure. Note that with auto-deploy mode, removing this
file will make the deployment eligible for deployment again.

.isundeploying — Placed by the deployment scanner service to indicate that it
has noticed a .deployed file has been deleted and the
content is being undeployed. This marker file will be deleted
when the undeployment process completes.

.undeployed — Placed by the deployment scanner service to indicate that the
given content has been undeployed from the runtime. If an end
user deletes this file, it has no impact.

.pending — Placed by the deployment scanner service to indicate that it
has noticed the need to deploy content but has not yet
instructed the server to deploy it. This file is created if
the scanner detects that some auto-deploy content is still in
the process of being copied or if there is some problem that
prevents auto-deployment. The scanner will not instruct the
server to deploy or undeploy any content (not just the
directly affected content) as long as this condition holds.

————————————————————————————-

Espero que tenha ajudado!

Aquele Abraço