Version 10

    Turn the Deployment Scanner frequency down or turn it off if you do not hot deploy.

     

    Note:  The guidance on if you should do this or not is this.

     

    If you use this in a test or development environment, you can keep the scanner on.  If you use this in production, you should turn the scanner off or turn the frequency down.  Hot deploy is not recommended for production systems.  If you are deploying or redeploying a component in production, you should bring JBoss down, change your component, and then bring it back up.

     

    Hot deployment works well, but you may not have flushed everything out that you need to.  Especially if you are holding static references.  When you redploy, you get new classes with a new classloader.  If you are holding static references to a previous classloaders classes anywhere, you could be in trouble.

     

    It's always a good idea, when you need a reliable service, to reboot JBoss after making a change.  So in production I would recommend that the Deployment scanner is turned off.  If you need to upgrade in a cluster, I would recommend a rolling blackout in order to upgrade components.

     

    JBoss 7.x

    The scanner is only available for the standalone mode, in domain mode there is a central domain deploy management!

     

    see scan-enabled and scan-interval in https://docs.jboss.org/author/display/AS7/Deployment+Scanner+configuration

    Also you might remove the scanner (e.g. for security reason), in this case deployments are only possible via CLI or Console as in the domain mode. See TuningAndSlimmingWiki

    JBoss 6.x

    1. Turning the scanner off

    The HDScanner can be disabled by setting the scan period property "disabled" to "true. The default is false.

     

        <bean name="ScanPeriod" class="org.jboss.profileservice.profile.metadata.plugin.ScanPeriod">
            <property name="scanPeriod">5</property>
            <property name="disabled">true</property>
        </bean>
    

    2. Changing the scanner frequency

    To change the scanner frequency, edit the conf/bootstrap/profile.xml file and add in a configuration for a org.jboss.profileservice.profile.metadata.plugin.ScanPeriod. Set the value of the scanPeriod property to the desired time in seconds between scans.  For example, the setting below will scan for new deployments every minute.  See this forum thread for more information.

     

    --- profile.xml          (revision 109701)
    +++ profile.xml          (working copy)
    @@ -40,8 +40,14 @@
                                   </list>
                         </property>
                         <property name="attachmentStoreRoot">${jboss.server.data.dir}/attachments</property>
    +                    <property name="scanPeriod"><inject bean="ScanPeriod" /></property>
               </bean>

    +          <!-- The scan period in seconds -->
    +          <bean name="ScanPeriod" class="org.jboss.profileservice.profile.metadata.plugin.ScanPeriod">
    +                    <property name="scanPeriod">60</property>
    +          </bean>
    +
               <!-- The profile service configuration -->

     

    In the code example above, the "ScanPeriod" bean is wired up as a property to the UserProfileFactory bean

     

    JBoss 5.x

     

    JBoss 5.x deployment scanning is controlled via the HDScanner which is enabled and configured via the deploy/hdscanner-jboss-beans.xml file in your profile's directory.

     

    1. Turning the scanner off

    To disable all hot deployment, simply remove the HDScanner service by removing the deploy/hdscanner-jboss-beans.xml file.

     

    2. Changing the scanner frequency

    To change the scanner frequency, edit the deploy/hdscanner-jboss-beans.xml file and change the value of the scanPeriod property to the desired time in milliseconds between scans.  For example, the setting below will scan for new deployments every minute:

     

    <property name="scanPeriod">60000</property>

     

     

    JBoss 4.3.x and earlier

     

    1. Turning the scanner off (Please reference the snippet below) 

    Find the line

     

    <attribute name="ScanEnabled">

     

    and change the value to false. For example:

     

    <attribute name="ScanEnabled">false </attribute>

     

    2. Turning the scanner frequency down(please reference the snippet below)

    find the Line

     

    <attribute name="ScanPeriod">5000</attribute>

     

    and change the value to something other than 5 seconds.  This time is in Milliseconds.  Change to something like 30 seconds.

     

    For example:

     

    <attribute name="ScanPeriod">30000</attribute>

     

     

    Reference: the snippet of xml from the jboss-service.xml file in conf

     

     

    <!-- An mbean for hot deployment/undeployment of archives.
       -->
       <mbean code="org.jboss.deployment.scanner.URLDeploymentScanner"
          name="jboss.deployment:type=DeploymentScanner,flavor=URL">
    
          <!-- Uncomment (and comment/remove version below) to enable usage of the
            DeploymentCache
          <depends optional-attribute-name="Deployer">jboss.deployment:type=DeploymentCache</depends>
          -->
          <depends optional-attribute-name="Deployer">jboss.system:service=MainDeployer</depends>
    
          <!-- The URLComparator can be used to specify a deployment ordering
               for deployments found in a scanned directory.  The class specified
               must be an implementation of java.util.Comparator, it must be able
               to compare two URL objects, and it must have a no-arg constructor.
               Two deployment comparators are shipped with JBoss:
                 - org.jboss.deployment.DeploymentSorter
                   Sorts by file extension, as follows:
                     "sar", "service.xml", "rar", "jar", "war", "wsr", "ear", "zip",
                     "*"
                 - org.jboss.deployment.scanner.PrefixDeploymentSorter
                   If the name portion of the url begins with 1 or more digits, those
                   digits are converted to an int (ignoring leading zeroes), and
                   files are deployed in that order.  Files that do not start with
                   any digits will be deployed first, and they will be sorted by
                   extension as above with DeploymentSorter.
          -->
          <attribute name="URLComparator">org.jboss.deployment.DeploymentSorter</attribute>
          
          <!--
          <attribute name="URLComparator">org.jboss.deployment.scanner.PrefixDeploymentSorter</attribute>
          -->
    
          <!-- The FilterInstance specifies a URLLister.URLFilter for scanned
               directories. This DeploymentFilter is initialized with the given
               prefixes, suffixes and matches that define which URLs should be
               ignored.
          -->
          <attribute name="FilterInstance"
             attributeClass="org.jboss.deployment.scanner.DeploymentFilter"
             serialDataType="javaBean">
             <!-- Files starting with theses strings are ignored -->
             <property name="prefixes">#,%,\,,.,_$</property>
             <!-- Files ending with theses strings are ignored -->
             <property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
             <!-- Files matching with theses strings are ignored -->
             <property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property>
          </attribute>
    
          <!-- Frequency in milliseconds to rescan the URLs for changes -->
          <attribute name="ScanPeriod">5000</attribute>
          
          <!-- A flag to disable the scans -->
          <attribute name="ScanEnabled">true</attribute>