Changeset 1778


Ignore:
Timestamp:
02/13/15 16:09:03 (4 years ago)
Author:
philsmart
Message:
 
Location:
raptor-mua/trunk/src/main
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • raptor-mua/trunk/src/main/config/database.xml

    r1566 r1778  
    1313    <bean id="muaSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
    1414        <property name="dataSource"> 
    15             <ref bean="muac3p0DataSource" /> 
     15            <ref bean="muac3p0DataSourceHSQLDB" /> 
    1616        </property> 
    1717        <property name="hibernateProperties"> 
    1818            <props> 
    19                  <prop key="hibernate.dialect"> org.hibernate.dialect.PostgreSQLDialect</prop> 
    20                  <!-- <prop key="hibernate.dialect"> org.hibernate.dialect.HSQLDialect</prop> --> 
     19                <!--  <prop key="hibernate.dialect"> org.hibernate.dialect.PostgreSQLDialect</prop> --> 
     20                  <prop key="hibernate.dialect"> org.hibernate.dialect.HSQLDialect</prop>  
    2121                <!-- <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect</prop> --> 
    2222                <!-- <prop key="hibernate.dialect"> org.hibernate.dialect.OracleDialect</prop> --> 
    2323                <prop key="hibernate.show_sql">false</prop> 
    24                 <prop key="hibernate.hbm2ddl.auto">update</prop> 
     24                <prop key="hibernate.hbm2ddl.auto">create</prop> 
    2525            </props> 
    2626        </property> 
     
    5050                <prop key="c3p0.max_statements">0</prop> 
    5151                <prop key="c3p0.min_size">10</prop> 
     52                <prop key="c3p0.timeout">100</prop> 
    5253                <prop key="user">postgres</prop> 
    5354                <prop key="password"></prop> 
  • raptor-mua/trunk/src/main/ddl/hibernate.cfg.xml

    r894 r1778  
    3434    <property name="hibernate.show_sql">true</property> 
    3535        <!-- mapping files --> 
    36         <mapping resource="uk/ac/cardiff/model/event/event.hbm.xml" /> 
     36        <mapping resource="uk/ac/cardiff/model/event/event-name-limit.hbm.xml" /> 
    3737    <mapping resource="uk/ac/cardiff/model/resource/resourcemetadata.hbm.xml"/> 
    3838    <mapping resource="uk/ac/cardiff/raptor/registry/releaseInformation.hbm.xml"/> 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/BaseCapabilitiesContructor.java

    r1312 r1778  
    2020 
    2121public abstract class BaseCapabilitiesContructor { 
     22         
     23        /** 
     24         *  
     25         * When building the cache, should it be whole or part recomputed. 
     26         * 
     27         */ 
     28        public enum ItemsToCompute{ 
     29                /** 
     30                 * Compute ALL aspects of the cache. 
     31                 */ 
     32                ALL, 
     33                /** 
     34                 * Compute only the statistical units. 
     35                 */ 
     36                STATISTICS 
     37        } 
    2238 
    2339    public abstract Capabilities getCapabilities(); 
    2440 
    2541    /** If things have changed, the cache should be invalidated immediately. */ 
    26     public abstract void invalidateCache(); 
     42    public abstract void invalidateCache(ItemsToCompute items); 
    2743 
    2844    /** called to initialise this capabiliies constructor. If needed. */ 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/CapabilitiesConstructor.java

    r1360 r1778  
    3333import uk.ac.cardiff.model.wsmodel.Capabilities; 
    3434import uk.ac.cardiff.raptor.store.EventStorageEngine; 
     35import uk.ac.cardiff.raptormua.engine.BaseCapabilitiesContructor.ItemsToCompute; 
    3536import uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler; 
    3637 
     
    9495                if ((System.currentTimeMillis() - cacheResetTimeMs) > cacheTimeoutMs) { 
    9596                    log.info("Capabilities cache was cleared, timeout reached"); 
    96                     queueCapabilitiesConstruction(); 
     97                    queueCapabilitiesConstruction(ItemsToCompute.ALL); 
    9798                } 
    9899            } 
     
    116117     */ 
    117118    public void initialiseCapabilities() { 
    118         queueCapabilitiesConstruction(); 
    119     } 
    120  
    121     private void queueCapabilitiesConstruction() { 
     119        queueCapabilitiesConstruction(ItemsToCompute.ALL); 
     120    } 
     121 
     122    private void queueCapabilitiesConstruction(final ItemsToCompute items) { 
    122123        log.info("Capabilities constructor called, adding request to thread queue, with {} currently active", 
    123124                capabilitiesConstructionService.getActiveCount()); 
     
    126127            if (statisticsHandler != null && storageEngine != null && metadata != null) { 
    127128                CapabilitiesConstructorTask constructor = 
    128                         new CapabilitiesConstructorTask(this, statisticsHandler, storageEngine, metadata); 
     129                        new CapabilitiesConstructorTask(this, statisticsHandler, storageEngine, metadata, items, cachedCapabilities); 
    129130                constructor.setExcludeFieldNames(excludeFieldNames); 
    130131                capabilitiesConstructionService.submit(constructor); 
     
    156157     * If called, cache timeout is reset, and a call to construct new capabilities is placed on the queue. 
    157158     */ 
    158     public void invalidateCache() { 
    159         queueCapabilitiesConstruction(); 
     159    public void invalidateCache(ItemsToCompute items) { 
     160        queueCapabilitiesConstruction(items); 
    160161        cacheResetTimeMs = System.currentTimeMillis(); 
    161162    } 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/CapabilitiesConstructorTask.java

    r1530 r1778  
    3838import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    3939import uk.ac.cardiff.raptor.store.EventStorageEngine; 
     40import uk.ac.cardiff.raptormua.engine.BaseCapabilitiesContructor.ItemsToCompute; 
    4041import uk.ac.cardiff.raptormua.engine.statistics.BaseStatistic; 
    4142import uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler; 
     
    6667 
    6768    private Capabilities capabilities; 
     69     
     70    private Capabilities oldCachedCapabilities; 
     71     
     72    /** 
     73     * Which aspects of the cache should be recomputed. 
     74     */ 
     75    private ItemsToCompute toCompute; 
    6876 
    6977    /** Set containing the names of fields that should not be included in the list of possible field values */ 
     
    7280    public CapabilitiesConstructorTask(CallbackInterface<Capabilities> callbackInterface, 
    7381            StatisticHandler statisticsHandlerToUse, EventStorageEngine storageEngineToUse, 
    74             ServiceMetadata metadataToUse) { 
     82            ServiceMetadata metadataToUse, ItemsToCompute toCompute, Capabilities oldCachedCapabilities) { 
    7583        callback = callbackInterface; 
    7684        statisticsHandler = statisticsHandlerToUse; 
    7785        storageEngine = storageEngineToUse; 
    7886        metadata = metadataToUse; 
     87        this.toCompute = toCompute; 
     88        this.oldCachedCapabilities = oldCachedCapabilities; 
    7989    } 
    8090 
     
    8999        return null; 
    90100    } 
    91  
    92     private void doConstructCapabilities() { 
    93         long startTime = System.currentTimeMillis(); 
    94         capabilities = new Capabilities(); 
     101     
     102    private void doFullCapabilitiesConstruction(){ 
     103        capabilities = new Capabilities(); 
    95104        capabilities.setMetadata(metadata); 
    96105        addStatisticInformation(); 
     
    100109        addEventDateInformation(); 
    101110        addResourceInformation(); 
     111    } 
     112     
     113    private void doStatisticalInformationCapabilitiesConstruction(){ 
     114        capabilities = new Capabilities(); 
     115        capabilities.setMetadata(metadata); 
     116        addStatisticInformation(); 
     117        addStatisticTypeInformation(); 
     118        //of note, a reference to the existing object is fine here - we want the old one. 
     119        capabilities.setSuggestionValues(oldCachedCapabilities.getSuggestionValues()); 
     120        capabilities.setEventsPerType(oldCachedCapabilities.getEventsPerType()); 
     121        capabilities.setLatestEventTime(oldCachedCapabilities.getLatestEventTime()); 
     122        capabilities.setEarliestEventTime(oldCachedCapabilities.getEarliestEventTime()); 
     123        capabilities.setResourceMetadata(oldCachedCapabilities.getResourceMetadata()); 
     124 
     125    } 
     126 
     127    private void doConstructCapabilities() { 
     128        long startTime = System.currentTimeMillis(); 
     129         
     130        if (toCompute==ItemsToCompute.ALL){ 
     131                log.info("Computing ALL aspects of this MUAs capabilities"); 
     132                doFullCapabilitiesConstruction(); 
     133        }else if (toCompute==ItemsToCompute.STATISTICS){ 
     134                log.info("Computing only the statistical information aspects of this MUAs capabilities"); 
     135                doStatisticalInformationCapabilitiesConstruction(); 
     136        } 
     137         
    102138        try { 
    103139            String version = 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/MUAEngine.java

    r1549 r1778  
    5353import uk.ac.cardiff.raptor.store.ResourceStorageEngine; 
    5454import uk.ac.cardiff.raptor.store.TransactionInProgressException; 
     55import uk.ac.cardiff.raptormua.engine.BaseCapabilitiesContructor.ItemsToCompute; 
    5556import uk.ac.cardiff.raptormua.engine.statistics.BaseStatistic; 
    5657import uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler; 
     
    317318                .getEndTimeAsJavaDate()); 
    318319        statisticsHandler.updateStatisticalUnit(statisticalUnitInformation); 
    319         capabilitiesConstructor.invalidateCache(); 
     320        capabilitiesConstructor.invalidateCache(ItemsToCompute.STATISTICS); 
    320321 
    321322    } 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/service/impl/MUAProcessImpl.java

    r1530 r1778  
    113113                engine.release(); 
    114114            } catch (Exception e) { 
    115                 log.error("Error trying to release events, write lock in operation, reason = [{}]", e.getMessage()); 
     115                log.error("Error trying to release events, reason = [{}]", e); 
    116116            } finally { 
    117117                writeLock.unlock(); 
Note: See TracChangeset for help on using the changeset viewer.