How to pre-load Coherence Caches used within an OEP Application

Hi OEP/Coherence guys,
I'm currently developing an OEP application that was consuming database inputs in CQL queries.
I've replaced database direct access by Coherence caches access. My Coherence Local caches use a cache loader to fetch rows (by key) when there is a cache miss. This is working well, and the caches get filled in during the execution of my OEP application.
The problem is that if CQL queries are made on some attributes (not the key) of not-yet-cached data, the load method of my cache loader is not invoked and there is no result to my CQL query.
I'm wondering how to pre-load my data in Coherence Caches, from the database, when the OEP application starts to avoid such kind of problems...
Thx for any advice.
Renato

Hi.
Could you please describe the way to "set-up a cache-loader to load data into your cache when the OEP application starts" ?
I have a cache-loader configured with my cache. My cache-loader implements the "com.tangosol.net.cache.CacheLoader" interface.
This interface only defines 2 methods:
load(java.lang.Object oKey) ==> Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
loadAll(java.util.Collection colKeys) ==> Return the values associated with each the specified keys in the passed collection.
None of these methods allows me to pre-load my data (and BTW it looks like "loadAll" is never called by OEP)
Thx
RP

Similar Messages

  • How to get Oracle Coherence caching running within CQ5

    I've been trying to get Oracle Coherence running within CQ5 and I'm having problems with the setup.  First, I've been successful in creating an OSGi bundle jar from coherence.jar and it does deploy successfully through the Felix OSGi console.  But when I try to execute code using the Coherence classes, I get RMI marshalling run-time errors.  I've resolved the other run-time errors that have to do with the Import-Package definition in manifest.mf for the bundle.  I believe that the root problem that I'm facing is the deployment of the files tangosol-coherence-override.xml and the additional xml file that it points to.  I don't believe that these two files are being found within CQ5 correctly.  I've tried placing these files in the following locations:
    1.  Within coherence.jar itself (at the root directory)
    2.  In the CQ5 application's install folder
    3.  In the CQ5 application's src/main/resources folder
    Has anyone ever deployed Oracle Coherence in CQ5 or can give me a suggestion on what to try?  I appreciate any help or ideas.
    Thanks!  - Charlie

    There are 3 options which is described below. The steps may slightly vary based on cq & Oracle Coherence version. The details mentioned below are for cq5.4 & Coherence 3.7.1
    Option 1:-  Oracle recommended way
    *     Create a basic Web application directory
    /Sample.jsp
    /WEB-INF/web.xml
    /WEB-INF/classes/tangosol-coherence-override.xml
    /WEB-INF/lib/coherence.jar
    *     jar -cvf hello.war *
    *     Deploy the hello.war file by going to cq servlet engine at http://<host>:<port>/admin
    *     Access your sample with http://<host>:<port>/<contextroot>/Sample.jsp
    Option 2:-  Combination of Option 1 & Option 3
    *      Stop the cq
    *      Place coherence.jar at <CQ_Install_Dir>/crx-quickstart/server/runtime/0/_/WEB-INF/lib/
    *      Place tangosol-coherence-override.xml and all additional xml files at <CQ_Install_Dir>/crx-quickstart/server/runtime/0/_/WEB-INF/classes/
    *      Modify <CQ_Install_Dir>/crx-quickstart/launchpad/sling.properties to add below properties
    sling.bootdelegation.com.tangosol.net.cache=com.tangosol.net.cache
    sling.bootdelegation.com.tangosol.net=com.tangosol.net
    sling.bootdelegation.com.tangosol.util=com.tangosol.util
    *       Start the cq
    *       Verify jsp script etc... by putting into cache.. Same thing like
            <%
                String key = "k2";
                String value = "Hello World from cq!";
    ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
    ClassLoader newLoader = com.tangosol.net.CacheFactory.class.getClassLoader();
    Thread.currentThread().setContextClassLoader(newLoader);
                CacheFactory.ensureCluster();
                NamedCache cache = CacheFactory.getCache("hello-example");
                cache.put(key, value);
                out.println((String)cache.get(key));
                CacheFactory.shutdown();
    Thread.currentThread().setContextClassLoader(oldLoader);
             %>
    Option 3 :-   The one you are trying by creating an OSGi bundle jar from coherence.jar & prefeerd approach also. I haven't tried this approach but just throughing some thaughts.
    *    From some of oracle seminors I remembered oracle had a plans to have OSGi jar for Coherence. Try to get that instead of building the one ourself.
    *    If it is not available then Looking at your problem as a workaround i can think of is try with putting the XML file in the repository  & load xml in java class something like as
    getClass().getClassLoader().getResourceAsStream("tangosol-coherence-override.xml")

  • Pre-load the Cache during Application-Start Up

    Our requirement is to pre-load the cache during the application start-up most probably during Authentication/Authorization Service is invoked.
    We plan to load the data for other services from database into Coherence cache so that when user access that particular service he ends up hitting the Cache instead of database.
    Any pointers/suggestions on how to pre-load the cache during application start-up would be greatly appreciated. We are using Spring, Hibernate, Weblogic Web Services
    Regards,
    Bansi

    Hi Bansi,
    I were using following approach.
    First, we never use CacheFactory.getCache() in application code instead all instances of named cache were injected.
    On server side, I have an CacheInitializerBean which were starting cache preloading process (in separate thread). After preloading a special marker entry were put to the cache, indicating what data in the cache are consistent.
    When injecting named cache instance, we use a factory. This factory use CacheFactory.getCache() internally, but it check presence of marker object in cache an blocks until marker object will appear.
    Well in practice things are little more complicated but this is basic idea.
    Preload cache asynchronously and use marker to indicate completion of loading process.
    Hope this will help.
    Regards,
    Alexey

  • Pre-loading the Cache from Database during application start-up

    We are using Spring, Hibernate, Oracle Coherence 3.5.2 Weblogic Webservices
    Our requirement is to pre-load the cache during the application start-up most probably during Authentication/Authorization Service is invoked.
    We plan to load the data for other services from database into Coherence cache so that whenever user access that particular service he ends up hitting the Cache instead of database.
    We would greatly appreciate sample code snippets on how to write CacheInitializerBean with marker to demonstrate the state of cache.

    Hi Rob,
    Thanks for pointing to the article: Pre-Loading the Cache
    In fact i already looked at that article before posting. It just mentions how to load the data from database into Cache.
    What i am looking for is how to make this happen during application start-up. This is my first hurdle.
    The second one is as mentioned in the article http://coherence.oracle.com/display/COH35UG/Pre-Loading+the+Cache
    i wrote following code which never gets populated into cache. Not sure whats going wrong even though i see Hibernate loadAll() method loading all the objects in the console
    public   void populateCache() throws SQLException
        Map<Long, Object>  buffer = new HashMap<Long, Object>();
        int count = 0;
         List<Contract> contractList = this.getHibernateTemplate().loadAll(Contract.class);
         log.debug("contractList size="+contractList.size());
         for(Contract contract : contractList)
             Long key   = new Long(contract.getId());
             Object  value = contract;
             buffer.put(key, value);
             // this loads 1000 items at a time into the cache
             if ((count++ % 1000) == 0)
                  contractCache.putAll(buffer);
                 buffer.clear();
         if (!buffer.isEmpty())
              contractCache.putAll(buffer);
        }We would greatly appreciate your time in helping us resolving two hurdle blocks.

  • How uninstall Pre loaded games in my ASHA 308

    How uninstall Pre loaded games in my ASHA 308

    If you go to the games folder or app folder you can do so there,if the games cant be removed they are part of the software and cant be deleted.
    If  i have helped at all a click on the white star below would be nice thanks.
    Now using the Lumia 1520

  • Pre-loading the cache

    I'm attempting to pre-load the cache with data and have implemented controllable caches as per this document (http://wiki.tangosol.com/display/COH35UG/Sample+CacheStores). My cache stores are configured as write-behind with a 2s delay:
    <cache-config>
         <caching-scheme-mapping>
         <cache-mapping>
              <cache-name>PARTY_CACHE</cache-name>
              <scheme-name>party_cache</scheme-name>
         </cache-mapping>
         </caching-scheme-mapping>
         <caching-schemes>
              <distributed-scheme>
                <scheme-name>party_cache</scheme-name>
                <service-name>partyCacheService</service-name>
                <thread-count>5</thread-count>
                <backing-map-scheme>
                    <read-write-backing-map-scheme>
                         <write-delay>2s</write-delay>
                        <internal-cache-scheme>
                            <local-scheme/>
                        </internal-cache-scheme>
                        <cachestore-scheme>
                            <class-scheme>
                                <class-name>spring-bean:partyCacheStore</class-name>
                            </class-scheme>
                        </cachestore-scheme>
                    </read-write-backing-map-scheme>
                </backing-map-scheme>
                <autostart>true</autostart>
            </distributed-scheme>
         </caching-schemes>
    </cache-config>
    public static void enable(String storeName) {
            CacheFactory.getCache(CacheNameEnum.CONTROL_CACHE.name()).put(storeName, Boolean.TRUE);
    public static void disable(String storeName) {
            CacheFactory.getCache(CacheNameEnum.CONTROL_CACHE.name()).put(storeName, Boolean.FALSE);
    public static boolean isEnabled(String storeName) {
            return ((Boolean) CacheFactory.getCache(CacheNameEnum.CONTROL_CACHE.name()).get(storeName)).booleanValue();
    public void store(Object key, Object value) {
            if (isEnabled(getStoreName())) {
                throw new UnsupportedOperationException("Store method not currently supported");
        }The problem I have is that what seems to be happening is:
    1) bulk loading process calls disable() on the cache store
    2) cache is loaded with data
    3) bulk loading process calls enable() on the cache store ready for normal operation
    4) the service thread starts to attempt to store the data as the check to see if the store is enabled returns true because we set it to true in step 3
    so is there a way of temporarily disabling the write-delay or changing it programatically so step 4 doesn't happen?

    Adding
    Thread.sleep(10000);after loading the data seems to solve the problem but this seems dirty, any better solutions?

  • IPad:  Any advice on getting a pre-loaded Sim for use overseas (Europe)?

    iPad:  Any advice on getting a pre-loaded Sim for use overseas (Europe)?

    Thanks, I thought this was the case, checking to see if anything had changed.  Spain is the country in question.  We previously were not able to obtain a Sim there but that may have been because of a carrier or individual employee problem.  Will certainly try again next time (we did get a carrier Sim successfully in Italy one time).  Cheers

  • How to pre - load all database rows into cache

    Hi All,
    The below is my cache configuration, I would like to know how to load all the database rows/specified number of rows into the cache.
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
    <caching-scheme-mapping>
    <cache-mapping>
    <cache-name>TableEmp</cache-name>
    <scheme-name>distributed-hibernate</scheme-name>
    <init-params>
    <init-param>
    <param-name>entityname</param-name>
    <param-value>com.tangosol.examples.explore.Emp</param-value>
    </init-param>
    </init-params>
    </cache-mapping>
    </caching-scheme-mapping>
    <caching-schemes>
    <distributed-scheme>
    <scheme-name>distributed-hibernate</scheme-name>
    <backing-map-scheme>
    <read-write-backing-map-scheme>
    <internal-cache-scheme>
    <local-scheme></local-scheme>
    </internal-cache-scheme>
    <cachestore-scheme>
    <class-scheme>
    <class-name>
    com.tangosol.coherence.hibernate.HibernateCacheStore
    </class-name>
    <init-params>
    <init-param>
    <param-type>java.lang.String</param-type>
    <param-value>{entityname}</param-value>
    </init-param>
    </init-params>
    </class-scheme>
    </cachestore-scheme>
    </read-write-backing-map-scheme>
    </backing-map-scheme>
    </distributed-scheme>
    </caching-schemes>
    </cache-config>
    Please kindly provide a solution.
    Regards
    S

    Hi Rich,
    Imagine I have just downloaded coherence, I have run a server with the default config. From what you said to S coherence can pull the data from database itself WITHOUT me having to push it to coherence? If so can you please explain how this done, or point me at a guide?You might start with [Read-Through Caching|http://coherence.oracle.com/display/COH34UG/Read-Through%2C+Write-Through%2C+Write-Behind+and+Refresh-Ahead+Caching#Read-Through%2CWrite-Through%2CWrite-BehindandRefresh-AheadCaching-ReadThroughCache] to understand how Coherence can pull data. It is the implementation of a CacheLoader that enables the Coherence cache to pull the data.
    The cache configuration that S provided specifies a read-write-backing-map-scheme indicating that HibernateCacheStore class should be used by Coherence and is similar to the configuration discussed at [Using Hibernate as a CacheStore for Coherence|http://wiki.tangosol.com/display/COH34UG/Using+Hibernate+as+a+CacheStore+for+Coherence]. In responding to the original question, I was assuming that the data source being queried to be loaded into the cache is the same as the data source fronted by the Hibernate configuration.
    Secondly with the respects to the answer to my question. If I don't care about versioning ... do I need a EvolvablePortableObject? If you really don't want to version your serialized representations, you can implement the PortableObject interface instead but the additional cost of implementing EvolvablePortableObject is small and the potential benefit is great.
    So my question is, can coherence pull the data from the database using a preload request and serialize into a pof format without me having to push the data to coherence via a separate app? And if so could you please explain how? Or direct me at some documentation?You do not need to push data to Coherence via a separate app. Coherence can pull the data from the database. Coherence can also preload the cache using an EntryProcessor. You can configure Coherence to use POF and will need to implement POF serialization methods for your cache objects.
    The [Partitioned cache with a serializer|http://coherence.oracle.com/display/COH34UG/Sample+Cache+Configurations#SampleCacheConfigurations-Partitionedcacheofadatabase] example and the links it provides should provide sufficient documentation for configuring and using POF.
    Whether you decide to use the HibernateCacheStore, the TopLinkCacheStore or implement your own CacheStore or CacheLoader class to access your data in your database is your decision. You should be able to find sufficient documentation and examples to help you decide how you would like to use Coherence at the [Coherence Knowledge Base|http://wiki.tangosol.com/display/COH/Oracle+Coherence+Knowledge+Base+Home]. I would recommend starting with the [User Guide|http://wiki.tangosol.com/display/COH34UG/Coherence+3.4+Home] if you would like to get a better grasp of the overall architecture.
    Regards,
    Harv

  • Preload DB tables into Coherence Cache using HibernateDataStore

    Hi,
    I am trying to use Hibernate just to pre-load my database tables [reference data with millions of rows] into coherence cache [as pojos]. I started looking at the configuration file from the below link -
    http://coherence.oracle.com/display/COH35UG/Using+Hibernate+as+a+CacheStore+for+Coherence
    and could not grab much from there.
    Can someone plz provide clean steps on how i can use hibernate to pre-load my database tables into coherence. An example with pojo would be very helpful?
    Thank You,
    Jagadeesh.

    Hi, Steve
    Thanks for the information. I did look at the document regarding CacheLoader and read-through and read-ahead.
    I have the question based on the above info.
    1. Currently I am using Built-in CacheStore implementation: JPA CacheStore.
    Here is the configuration in persistance.xml.
    <backing-map-scheme>
    <read-write-backing-map-scheme>
    <!--
    Define the cache scheme
    -->
    <internal-cache-scheme>
    <local-scheme/>
    </internal-cache-scheme>
    <cachestore-scheme>
    <class-scheme>
    <class-name>com.tangosol.coherence.jpa.JpaCacheStore</class-name>
    <init-params>
    JpaCacheStore extends JpaCacheLoader and implments CacheStore interface.
    so in JpaCacheLoader, it has load and loadAll method implementation.
    Can I confirm in my case, i shouldn't do anything else regarding the read-through?
    Cheers
    Julia

  • How to Pre-load after onRelease

    Hi there. I want to be able to pre-load a movie clip or audio
    clip after a onRelease function. Right now I have audio playing
    onRelease. How do I script things to get the audio to preload from
    a Loader movie clip or script? Thanks for your input.
    Luke

    this should do it:
    var snd:Sound = new Sound()
    snd.onLoad = function(){
    var pct:Number =
    Math.round(snd.getBytesLoaded()/snd.getBytesTotal()*100);
    wait = setInterval(loadingSnd, 100)
    function loadingSnd(){
    if(pct >= 100){
    snd.start();
    clearInterval(wait);
    btn1.onRelease = function(){
    snd.loadSound("audio/loop1.mp3", false);

  • How to find smartform that is used within a transaction

    Hi experts,
    Im trying to find the smartform that are used behind transaction FNVS/me22n/zab1/zapb
    From me22n i know it uses zmedruck and i could find this by doing the following:
    transaction nace - ef - neu. there i could find everything, even the printprogram.
    this i found because someone told me you can find everything from orders there within EF.
    but the other transactions i don't know how to start looking for the smartform, as i cant debug those printpreviews neither.
    If someone can explain me how i can find the smartform used behind those printscreens that would help me a lot.
    regards,
    michael

    hi,
    i've put a external breakpoint and a normal breakpoint within the function module,
    but when i press the print preview it doesnt trigger :/
    [image breakpoint|http://img256.imageshack.us/img256/2888/capturede.png]
    even within me22n.
    Am i doing something wrong?
    thx already for the fast reaction.
    regards,
    Michael

  • How to list the active Alerts used within a tab(report) within a Document

    Hello
    We have a number of tabs/reports within a single webi document. There are a couple of alerts within the webi document but only one is used within a given tab/report.
    Is there an API around that will help me query the alerts that are enabled within each tab/report within a given document instance?
    There is an IReportProcessingInfo class that is around for it looks like its not applicable for Webi documents.
    Regards
    Madhu
    BO XI R2 SP2 on Windows 2003

    Hi Madhu,
    Below is a sample code to traverse through the ReportStructure and get the Alerters from the cells.
    Hope this helps.
    Regards,
    Dan
    Main:
                /************************** RETRIEVING PARAMETERS **************************/
                // Retrieve the logon information
                String username = "username";
                String password = "password";
                String cmsName  = "cms name";
                String authType = "secEnterprise"; 
                // Retrieve the name of the Web Intelligence document to be used in the sample
                String webiDocName = "WebI Alerter Test";
                /************************** LOGON TO THE ENTERPRISE **************************/
                // Logon to the enterprise
                IEnterpriseSession boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( username, password, cmsName, authType);
                /************************** RETRIEVE INFOOBJECT FOR THE WEBI DOCUMENT **************************/
                // Retrieve the IInfoStore object
                IInfoStore boInfoStore =(IInfoStore) boEnterpriseSession.getService("InfoStore"); 
                session.setAttribute("SAMPLE.InfoStore", boInfoStore); 
                // Build query to retrieve the universe InfoObjects
                String sQuery = "SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND='" + CeKind.WEBI + "' AND SI_NAME='" + webiDocName + "'";
                // Execute the query
                IInfoObjects boInfoObjects = (IInfoObjects) boInfoStore.query(sQuery);
                // Retrieve the InfoObject for the Web Intelligence document
                IInfoObject boInfoObject = (IInfoObject) boInfoObjects.get(0);
                /************************** RETRIEVE DOCUMENT INSTANCE FOR THE WEBI DOCUMENT **************************/
                // Retrieve the Report Engines
                ReportEngines boReportEngines = (ReportEngines) boEnterpriseSession.getService("ReportEngines");;
                // Retrieve the Report Engine for Web Intelligence documents
                ReportEngine boReportEngine = boReportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
                // Retrieve the document instance for the Web Intelligence document
                DocumentInstance boDocumentInstance = boReportEngine.openDocument(boInfoObject.getID());
                ReportStructure boReportStructure = boDocumentInstance.getStructure();
                out.print(traverseReportStructure(boReportStructure));
                out.print("&lt;HR>Process Complete!&lt;HR>");
                boDocumentInstance.closeDocument();
                boReportEngine.close();
                boEnterpriseSession.logoff();
    Functions:
    String traverseReportStructure(ReportStructure boReportStructure) {
                String output = "";
                for (int i=0; i&lt;boReportStructure.getReportElementCount(); i++) {
                            output += traverseReportElement(boReportStructure.getReportElement(i), 0);
                return output;
    String traverseReportElement(ReportElement boReportElement, int level) {
                String output = "";
                String padding = getPadding(level);
                if (boReportElement instanceof ReportContainer) {
                            output += padding + "Report Name: " + ((ReportContainer) boReportElement).getName() + "&lt;BR>";
                } else if (boReportElement instanceof PageHeaderFooter) {
                            if (((PageHeaderFooter) boReportElement).isHeader()) {
                                        output += padding + "Report Header&lt;BR>";
                            } else {
                                        output += padding + "Report Footer&lt;BR>";
                } else if (boReportElement instanceof ReportBody) {
                            output += padding + "Report Body&lt;BR>";
                } else if (boReportElement instanceof Cell) {
                            output += padding;
                            output += "Cell ID: " + ((Cell) boReportElement).getID() + " - ";
                            output += getAlerters(((Cell) boReportElement).getAlerters(), level+1);
                } else if (boReportElement instanceof ReportBlock) {
                            output += padding + "Block Name: " + ((ReportBlock) boReportElement).getName() + "&lt;BR>";
                            output += traverseReportBlock((ReportBlock) boReportElement, level+1);
                } else {
                            output += padding + boReportElement.getClass().getName() + "&lt;BR>";
                for (int i=0; i&lt;boReportElement.getReportElementCount(); i++) {
                            output += traverseReportElement(boReportElement.getReportElement(i), level+1);
                return output;
    String traverseReportBlock(ReportBlock boReportBlock, int level) {
                String output = "";
                String padding = getPadding(level);
                Representation boRepresentation = boReportBlock.getRepresentation();
                output += padding + "Block type is [" + boRepresentation.getClass().getName() + "].&lt;BR>";
                if (boRepresentation instanceof SimpleTable) {
                            SimpleTable boSimpleTable = (SimpleTable) boRepresentation;
                            output += padding + "Processing SimpleTable...&lt;BR>";
                            output += padding + "Block Header&lt;BR>" + traverseCellMatrix(boSimpleTable.getHeader(null), level+1);
                            output += padding + "Block Body&lt;BR>" + traverseCellMatrix(boSimpleTable.getBody(), level+1);
                            output += padding + "Block Footer&lt;BR>" + traverseCellMatrix(boSimpleTable.getFooter(null), level+1);
                } else {
                            output += padding + "Unhandled Block Type...&lt;BR>";
                return output;
    String traverseCellMatrix(CellMatrix boCellMatrix, int level) {
                String output = "";
                String padding = getPadding(level);
                if (boCellMatrix.getRowCount()>0) {
                            TableCell boTableCell = null;
                            for (int i=0; i&lt;boCellMatrix.getColumnCount(); i++) {
                                        boTableCell = (TableCell) boCellMatrix.getCell(0, i);
                                        output += padding + "Column: " + i + " - " + boTableCell.getText() + " - ";
                                        output += getAlerters(boTableCell.getAlerters(), level+1);
                } else {
                            output += padding + "No Cells.&lt;BR>";
                return output;
    String getAlerters(Alerters boAlerters, int level) {
                String output = "";
                String padding = getPadding(level);
                if (boAlerters.getCount()&lt;=0) {
                            output += "No alerters.&lt;BR>";
                } else {
                            output += "Alerters found!&lt;BR>";
                            Alerter boAlerter = null;
                            for (int i=0; i&lt;boAlerters.getCount(); i++) {
                                        boAlerter = boAlerters.getAlerter(i);
                                        output += padding + "&lt;B>" + boAlerter.getName() + "&lt;/B>&lt;BR>";
                return output;
    String getPadding(int level) {
                String output = "";
                for (int i=0; i&lt;level; i++) {
                            output += "     ";
                return output;
    Edited by: Dan Cuevas on May 25, 2009 9:45 PM

  • How to transfer the coherence cache t to a different network/environment?

    Hi,
    I have a requirement where in i need to import/export cache from one network into a different network/environment all together keeping the cache data intact. How do i achieve this from Coherence side? I am using distributed cache scheme.
    Regards,
    Radhika

    You could serialize to a file the content of the cache then read it back at the other end.  The cache dump usually does not take much time even for GB sized caches.  The import usually takes more time.
    Here is sample code to serialize the content of a cache.  Ideally you should use POF to have already compacted data.
    Export:
         public void exportCache(String cacheName, File file) throws Exception {
              WrapperBufferOutput wrappedBufferOutput = null;
              try {
                   NamedCache cache = CacheFactory.getCache(cacheName);
                   FileOutputStream fileOutputStream = new FileOutputStream(file);
                   BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream, 1024 * 1024);
                   DataOutputStream dataOutputStream = new DataOutputStream(bufferedOutputStream);
                   wrappedBufferOutput = new WrapperBufferOutput(dataOutputStream);
                   ConfigurablePofContext pofContext = (ConfigurablePofContext) cache.getCacheService().getSerializer();
                        for (Object o : cache.entrySet()) {
                             pofContext.serialize(wrappedBufferOutput, ((Map.Entry) o).getValue());
              } finally {
                   if (wrappedBufferOutput != null) {
                        wrappedBufferOutput.close();
             timer.print();
    Here is sample code to deserialize the content of a cache store on a file:
    Import:
    public void importCache(String cacheName, File file) throws Exception {
              WrapperBufferInput wrappedBufferInput = null;
              try {
                   NamedCache cache = CacheFactory.getCache(cacheName);
                   FileInputStream fileInputStream = new FileInputStream(file);
                   BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream, 1024 * 1024);
                   DataInputStream dataInputStream = new DataInputStream(bufferedInputStream);
                   wrappedBufferInput = new WrapperBufferInput(dataInputStream);
                   ConfigurablePofContext pofContext = (ConfigurablePofContext) cache.getCacheService().getSerializer();
                   while (wrappedBufferInput.available() > 0) {
                        ImportableObject o = (ImportableObject) pofContext.deserialize(wrappedBufferInput);
                        cache.put(o.getObjectKey(), o);
              } finally {
                   if (wrappedBufferInput != null) {
                        wrappedBufferInput.close();
    Here we assume that cache entries implement ImportableObject interface which has the getObjectKey() method.  This make it easy to figure out the key of the entry without knowing its real type.

  • Issue in How-To document "Load flat file using SAPGUI"?

    Hi,
    I'm having an issue with following lines in the How-To document.
    I've a characteristic "CHAR1" which is restricted with multuple values in the planning level.
    after the upload using this document, CHAR1 is being loaded incorrect & during my debugging I've noticed that program is changing CHAR1 values while executing following lines of code.
    It works fine, if i don't have a restriction for CHAR1 at planning level.
    It also works fine, if i restricted CHAR1 with a single value in level.
    It's not working as expected, if i restrict CHAR1 with multiple single values.
    incase of multiple single values restriction, following is happening.
    let's say i load following file & i restricted CHAR1 with values "aaaaa,fffff" in level.
    CHAR1 CHAR2 value
    aaaaa bbbbb 1000
    fffff eeeee 2000
    it's being loaded as follows. Program is changing all values of CHAR1 with 1st value of the restricted multiple values and in this case, it is "aaaaa".
    CHAR1 CHAR2 value
    aaaaa bbbbb 1000
    aaaaa eeeee 2000
    Has any one encountered the same problem?
    Marc,
    Could you please comment on this.
    >>> INSERT
    Set fixed fields
    LOOP AT ito_chasel INTO ls_chasel.
    READ TABLE ls_chasel-t_charng INTO ls_charng INDEX 1.
    IF sy-subrc = 0 AND ls_charng-option = 'EQ'.
    ASSIGN COMPONENT ls_chasel-chanm OF STRUCTURE ls_data-s_chas TO <f>.
    IF sy-subrc = 0.
    <f> = ls_charng-low.
    ENDIF.
    ENDIF.
    ENDLOOP.
    <<< INSERT
    Appreciate any help.
    Hari Immadi
    http://immadi.com
    SEM BW Analyst

    Marc,
    I still need to keep the lines of coding as I've few characteristics restrictied to single values & one characteristic restricted to multiple single values.
    when the coding is commented out, single value restricted characteristics are not getting populated with any value.
    I'm counting the table entries "ls_chasel-t_charng" and if entries are 1, then am activating the code. this seems to be working fine. Do you see any problems/issues with this?
    Hari Immadi
    http://immadi.com
    SEM BW Analyst

  • How do I clear the cache using a Mac with ver. 3.6.3?

    I am using a Mac OS x (10.6.2). I need to clear the cache in Firefox ver. 3.6.3. Please help. Thank you.
    == This happened ==
    Not sure how often
    == Today

    You are most welcome

Maybe you are looking for

  • How do I copy my email messages to my new ipad?

    Hello, Just got a new iPad, and I would like to transfer the email messages that are saved on the old ipad to the new one. I'm not bothered for the settings, as they are easy enough to do on the new one. I checked the articles about backing up and re

  • HT5364 lost search field in safari. how do i get it back?

    lost search field in safari. how do i get back

  • Is it possible to read and learn the BW by self..

    Hello Gurus, I am really interested in SAP BW/BI ,is it possible to learn this module by self,if yes please let me know the book i need to refer..

  • RSDRI_INFOPROV_READ

    Hello, we r trying to read data from infocufe using FM 'RSDRI_INFOPROV_READ'. Infocube Name : DPCC04DFD Structure : Country                   DPCNTY    CHAR 02 DPCNTY CPG/Retail Indicator DPCPG     CHAR 01 DPCPG Customer Group      DPCUSGP CHAR 20 DP

  • Help! use DataSource in Tomcat

    I configure server.xml and web.xml in tomcat to use DataSource server.xml is <Resource name="jdbc/jsptest" auth="Container"                type="javax.sql.DataSource"/>                <ResourceParams name="jdbc/jsptest">                     <paramete