What is multi threading?

Hi all,
What is multi threading? How to implement multi threading in ABAP?
Regards,
Bryan

Hi
How the vision connector framework works
The connector interacts with an SAP application using connector modules. The connector modules make calls to SAP's Native Interfaces and pass data (business object or event data) to and from an SAP application. The connector's flexible design enables different modules to be used for different tasks such as initializing the connector with the SAP application or passing business object data.
Communication between the connector and an SAP application
The connector uses SAP's Remote Function Call (RFC) library to communicate with an SAP application. SAP's RFC API allows external programs to call ABAP function modules within an SAP application.
Processing business objects
The connector is metadata driven. Metadata, in the WebSphere business integration system, is application-specific data that is stored in business objects and that assists a connector module in its interaction with the application. A metadata-driven connector module handles each business object that it supports based on metadata encoded in the business object definition rather than on instructions hard-coded in the connector module.
Business object metadata includes the structure of a business object, the settings of its attribute properties, and the content of its application-specific information. Because connector modules are metadata driven, they can handle new or modified business objects without requiring modifications to the connector-module code.
The vision connector framework uses the value of the verb application-specific information in the top-level business object to call the appropriate connector module to process the business object. The verb application-specific information provides the classname of the connector module.
The verb application-specific information of most top-level business objects must identify the classname of the connector module. The syntax of this verb application-specific information is:
AppSpecificInfo = PartialPackageName.ClassName,
For example,
AppSpecificInfo = sap.sapextensionmodule.VSapBOHandler,
In this example, sap.sapextensionmodule is the partial package name, and VSapBOHandler is the classname. The full package name includes the com.crossworlds.connectors prefix, which the WebSphere business integration system adds to the name automatically. In other words, the full text of the example is:
com.crossworlds.connectors.sap.sapextensionmodule.VSapBOHandler
Note:
The verb application-specific information of most top-level business objects must use a comma (,) delimiter after the connector classname. However, the Server verb, which is used by the RFC Server Module, is delimited instead by a semi-colon (;). For information about the Server verb, see How the RFC Server Module works and Supported verbs.
You need not specify the package name and classname for the verb application-specific information if the business object is used:
by the ALE Module to process application events; however, when you use the ALE Module to process service call requests, you must specify the package name and classname
by the ABAP Extension Module, which uses the default business object handler (sap.sapextensionmodule.VSapBOHandler)
Important:
Customer-generated connector modules that process business objects for the RFC Server Module must specify a full package name, which must begin with bapi. For example, bapi.client.Bapi_customer_getdetail2. The full package name in this example is bapi.client, and the classname is Bapi_customer_getdetail2.
Most business object processing is specific to each connector module. By default the connector uses the ABAP Extension Module. For more information on business object processing for the ABAP Extension Module, see Installing and customizing the ABAP Extension Module and Business object data routing to ABAP handlers. .
For more information on specifying verb application-specific information for the ALE Module, see Event processing and Processing multiple IDocs with a wrapper business object.
Processing multiple concurrent interactions
The Adapter Framework can create separate threads for processing an application event and a business object request. When processing multiple requests from the integration broker, it can create multiple threads to handle multiple business object requests. For example, when InterChange Server is the integration broker, the connector can receive multiple business object requests from multiple collaborations or from a multi-threaded collaboration.
Figure 4 illustrates the multi-threading architecture.
Figure 4. Multi-Threading Architecture of the Connector for SAP
Event processing
The connector performs the following steps when handling a poll call:
The Adapter Framework creates a single dedicated thread to handle poll calls. This thread calls the pollForEvents() method of the vision connector framework at the frequency specified in the PollFrequency configuration property.
The thread polls SAP, which uses a dialog process to locate and return the event.
Note:
If the connector's MaxNumberOfConnections configuration property evaluates to a number greater than 1, the vision connector framework dedicates a connection to SAP for polling. If MaxNumberOfConnections evaluates to 1, event and service-call request processing share a single connection to SAP.
The polling thread dies only when the connector shuts down.
Note:
Because the RFC Server connector agent pushes events out of SAP instead of polling for events, it spawns its own threads instead of using threads created by the connector framework. Because the ALE connector agent uses the RFC Server connector agent to access events, it also spawns its own threads instead of using threads created by the connector framework when it processes events.
Request processing
Independently of polling, the Adapter Framework can create multiple request-processing threads, one for each request business object. Each request thread instantiates the appropriate business object handler.
For example, when processing business object requests from InterChange Server, the number and type of business object handlers depends on the number and type of the collaborations sending the requests:
If multiple collaborations send business objects, each request thread instantiates a business object handler of the appropriate type.
If a multi-threaded collaboration sends multiple business objects of the same type, the request threads instantiate an equal number of business object handlers of that type.
If the connector's MaxNumberOfConnections configuration property evaluates to a number greater than 1, the vision connector framework dedicates one connection to SAP for polling and allocates the remaining connections to a pool used only for request processing.
As illustrated in Figure 4, the connector performs the following steps when handling a business object request:
The Adapter Framework creates a separate thread for each business object request. Each thread calls the doVerbFor() method of the Vision business object handler.
If the connector's MaxNumberOfConnections configuration property evaluates to a number greater than 1, the Vision business object handler checks the vision connector framework's connection pool to determine if a connection handle is available.
If the handle is available, the thread sends the request to SAP, which uses a dialog process to handle the request.
If the handle is not available, the thread waits until one becomes available. Thread sequencing determines the order in which each business object handler thread claims or waits for an available connection handle.
If the connector's MaxNumberOfConnections configuration property evaluates to 1, the Vision business object handler shares a connection with event processing.
SAP releases the dialog process after it completes processing and sends a return code.
The connector releases the connection handle after it receives the return code from SAP.
Setting the number of available connections
Use the MaxNumberOfConnections configuration property to specify the maximum number of connection handles available. The number of connections cannot exceed the number of dialog processes.
SAP locks the dialog process while processing an interaction, releasing it only when the interaction completes. Therefore, multiple concurrent requests lock an equal number of dialog processes until processing finishes.
Important:
Before setting a value for MaxNumberOfConnections, contact your SAP BASIS administrator to determine an appropriate value to maximize throughput without negatively affecting performance on the application server.
Support for multiple connections
By default the connector supports multiple-threads.
<b>
REWARD IF USEFULL</b>

Similar Messages

  • Trouble rationalizing use of multi-threading in run of the mill servlets

    Hey everybody,
    While spending time writing an internal wiki article on servlets for work, I asked myself a very basic question: What does multi-threading buy average servlets where the business logic requires procedural handling of the request?
    Don't get me wrong: I appreciate the fact that servlet containers spawning a new thread being less expensive than spawning an entirely new process is helpful and efficient. Coming from a background in PHP, it is great how servlets maintain persistence. However, as more of my coworkers are required to gain proficiency in Java and designing servlets, it is a question that many will ask and aside from having real-time processing of data files and other arduous tasks, I cannot think of any instances of where multi-threading benefits the application.
    What are some of the ways that you are using multi-threading with web applications?
    How would you explain why and where you would want to use multi-threading to someone?
    Thank you in advance for your insight,
    Andy

    how can we pass arguments to the run ()method?Create classes which implement Runnable that take your runtime parameters as constructor arguments and store them.
    eg: if your single thread method is   static void foo (int quantity, String name) {
        for (int i=0; i<quantity; i++) {
          System.out.println(name);
    // caller code
      foo(7, "wombats");Then you can make a runnable implementation thus:public class Foo implements Runnable {
      final int quantity_;
      final String name_;
      public Foo (int quantity, String name) {
        quantity_ = quantity;
        name_ = name;
      public void run () {
        for (int i=0; i<quantity_; i++) {
          System.out.println(name_);
    // caller code
      new Thread(new Foo(7, "wombats")).start();
    You could overload this method to take parameters in
    your class that implements the Runnable interface,
    and then call the base run() method.I don't get what you mean by this; Runnable is an interface so there is no base class run() method, and a run() overloaded with extra parameters method wouldn't get called by the thread.
    Pete

  • Indesign and multi threaded cpu support??????????

    When the indesign will finally support multi-core processors?????? It is tragic that adobe dont have any support for multi-core cpu and that this products cost thousends $$$$$!!!!!!!!!!!!!!! Only premiere and some photoshop function support multi-core cpu.

    If you are good freelancer you can get money spent on CS back in a month. So I would not call this software expensive. What concerns multi threaded cpu support I believe that programming tools as well as operating systems need to evolve. I am sure that we will get better support in this matter in close future.

  • What's wrong with my multi-threaded Matrix Mult. code? 1 thread is fastest

    For some reason, 1 thread performs the best. What's wrong with my implementation?
    import java.util.Random;
    import java.util.Date;
    import java.util.concurrent.ExecutorService;
    import java.util.concurrent.Executors;
    import java.util.concurrent.TimeUnit;
    public class Matrix {     
         private int values[][];
         private int rows;
         private int columns;
         public Matrix(int r, int c) {
              this.rows = r;
              this.columns = c;
              this.values = new int[r][c];
         private void randomize() {
              Random generator = new Random();
              for (int r = 0; r < this.rows; r++) {
                   for (int c = 0; c < this.columns; c++) {
                        this.values[r][c] = generator.nextInt(10);
         public String toString() {
              String out = "";
              for (int r = 0; r < this.rows; r++) {
                   for (int c = 0; c < this.columns; c++) {
                        if (c == 0) out += "[";
                        else out += "\t";
                        out += this.values[r][c];
                   out += "]\n";
              return out;
         public boolean equals(Object obj) {
              Matrix other = (Matrix) obj;
              if (this.columns != other.columns || this.rows != other.rows)  {
                   return false;
              for (int r = 0; r < this.rows; r++) {
                   for (int c = 0; c < this.columns; c++) {
                        if (this.values[r][c] != other.values[r][c]) {
                             return false;
              return true;
         // matrix multiplication using single thread
         public Matrix times(Matrix other) {
              assert(this.columns == other.rows);
              Matrix out = new Matrix(this.rows, other.columns);
              for (int r = 0; r < this.rows; r++) {
                   for (int c = 0; c < other.columns; c++) {
                        int dotProduct = 0;
                        for (int z = 0; z < this.columns; z++) {
                             dotProduct += this.values[r][z] * other.values[z][c];
                        out.values[r][c] = dotProduct;
              return out;
         // matrix multiplication with many threads
         public Matrix ptimes(Matrix other, int numberOfThreads) throws InterruptedException { // parallel
              assert(this.columns == other.rows);
              Matrix out = new Matrix(this.rows, other.columns);
              ExecutorService threadExecutor = Executors.newFixedThreadPool(numberOfThreads);
              for (int r = 0; r < this.rows; r++) {
                   for (int c = 0; c < other.columns; c++) {
                        threadExecutor.execute(new HelperThread(r, c, this, other, out));
              threadExecutor.shutdown();
              threadExecutor.awaitTermination(2, TimeUnit.DAYS);
              return out;
         private class HelperThread implements Runnable {
              private int row;
              private int col;
              private Matrix a;
              private Matrix b;
              private Matrix out;
              HelperThread(int r, int c, Matrix a, Matrix b, Matrix o) {
                   this.row = r;
                   this.col = c;
                   this.a = a;
                   this.b = b;
                   this.out = o;
              public void run() {
                   int dotProduct = 0;
                   for (int z = 0; z < a.columns; z++) {
                        dotProduct += this.a.values[row][z] * this.b.values[z][col];
                   this.out.values[row][col] = dotProduct;
         public static void main(String[] args) throws InterruptedException {
              int size = 100;
              Matrix a = new Matrix(size, size);
              a.randomize();     
              Matrix b = new Matrix(size, size);
              b.randomize();
              for (int t = 1; t < 15; t++) {
                   long start = new Date().getTime();
                   System.out.print(t + " threads: ");
                   Matrix c = a.ptimes(b, t);
                   //System.out.println(c);
                   long finish = new Date().getTime();
                   System.out.println((finish - start) + " milliseconds");
                   Matrix d = a.times(b);
                   assert(c.equals(d));
    }

    This one is even faster. On my dual core I get:
    Warmup
    Single Threaded
    5.20616 milliseconds
    5.52872 milliseconds
    5.12708 milliseconds
    5.59048 milliseconds
    5.16104 milliseconds
    5.1838 milliseconds
    5.37104 milliseconds
    5.1788 milliseconds
    5.18636 milliseconds
    5.15736 milliseconds
    Multi Threaded with 2 threads
    3.22184 milliseconds
    2.86552 milliseconds
    2.86284 milliseconds
    3.67032 milliseconds
    3.08032 milliseconds
    2.97388 milliseconds
    2.93084 milliseconds
    3.44012 milliseconds
    2.89744 milliseconds
    2.88136 milliseconds
    As you can see the Multi-Threaded versions are now faster.
        // matrix multiplication with many threads
        ExecutorService threadExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
        public Matrix ptimes(Matrix other) throws InterruptedException, ExecutionException {
            assert (this.columns == other.rows);
            Matrix out = new Matrix(this.rows, other.columns);
            Future futures[] = new Future[rows];
            for (int r = 0; r < this.rows; r++) {
                futures[r] = threadExecutor.submit(new HelperThread(r, this, other, out));
            for(Future f : futures) {
                f.get();
            return out;
        private class HelperThread implements Callable<Object> {
            private int row;
            private Matrix a;
            private Matrix b;
            private Matrix out;
            HelperThread(int r, Matrix a, Matrix b, Matrix o) {
                this.row = r;
                this.a = a;
                this.b = b;
                this.out = o;
            public String call() throws Exception {
                int dotProduct = 0;
                for (int c = 0; c < b.columns; c++) {
                    for (int z = 0; z < a.columns; z++) {
                        dotProduct += this.a.values[row][z] * this.b.values[z][c];
                    this.out.values[row][c] = dotProduct;
                return null;
        public static void main(String[] args) throws InterruptedException, ExecutionException {
            int size = 100;
            Matrix a = new Matrix(size, size);
            a.randomize();
            Matrix b = new Matrix(size, size);
            b.randomize();
            System.out.println("Warmup");
            for (int t = 0; t < 1000; t++) {
                Matrix c = a.ptimes(b);
                Matrix d = a.times(b);
                assert (c.equals(d));
            System.out.println("Single Threaded");
            for (int t = 0; t < 10; t++) {
                long start = System.nanoTime();
                Matrix d = a.times(b);
                long finish = System.nanoTime();
                System.out.println((finish - start)/1000000.0 + " milliseconds");
            System.out.println("Multi Threaded with " + Runtime.getRuntime().availableProcessors() + " threads");
            for (int t = 0; t < 10; t++) {
                long start = System.nanoTime();
                Matrix c = a.ptimes(b);
                long finish = System.nanoTime();
                System.out.println((finish - start)/1000000.0 + " milliseconds");
                Matrix d = a.times(b);
                assert (c.equals(d));
            System.exit(0);
        }

  • How to write a multi threaded Cache Event Listener

    I have a distributed data cache called tokenCache for my application. I have also added a mapListener to this cache to listen to a particular kind of events.
    tokenCache.addMapListener((MapListener) new TokenCacheListenerBean(), new MapEventFilter(tokenFilter), false);
    So bascially everytime a token (The domain object of this cache) is updated the entryUpdated() method in my EJB TokenCacheListenerBean is invoked.
    The issue I have though is that, from what I observe on running my code is that the Cache Listener is single threaded. So if two Token Objects on my tokenCache are updated,
    lets say Token Object A and Token Object B one after the other,  the entryUpdated() method in my EJB is invoked for Token Object A and  once the invocation is complete
    then the entryUpdated() method is invoked again for Token Object B(). At a given point of time there is only one instance of TokenCacheListenerBean EJB.  Is there a way to
    make this happen in multi-threaded manner ?
    Is there a configuration setting somewhere which allows multiple CacheListeners to be instantiated at a given point of time ?
    TokenCacheListenerBean  EJB_
    package oracle.communications.activation.asap.ace;
    import java.util.Iterator;
    import java.util.Set;
    import java.util.logging.Logger;
    import javax.ejb.Stateless;
    import com.tangosol.net.NamedCache;
    import com.tangosol.util.MapEvent;
    import com.tangosol.util.MapListener;
    import com.tangosol.util.ValueUpdater;
    import com.tangosol.util.extractor.PofExtractor;
    import com.tangosol.util.extractor.PofUpdater;
    import com.tangosol.util.filter.EqualsFilter;
    import com.tangosol.util.filter.LikeFilter;
    import com.tangosol.util.filter.LimitFilter;
    import com.tangosol.util.processor.UpdaterProcessor;
    * Session Bean implementation class TokenCacheListenerBean
    @Stateless
    public class TokenCacheListenerBean implements TokenCacheListenerBeanRemote, TokenCacheListenerBeanLocal, MapListener {
    NamedCache asdlCache;
    NamedCache tokenCache;
    private final int PAGE_SIZE = 1;
    private static Logger logger = Logger.getLogger(ConnectionManager.class.getName());;
    * An instance of the JCAModeler EJB, represents the JCA-JNEP
    JCAModeler jcaBean;
    * Default constructor.
    public TokenCacheListenerBean() {
    // TODO Auto-generated constructor stub
    public void entryDeleted(MapEvent Event) {
    public void entryInserted(MapEvent Event) {
    public void entryUpdated(MapEvent Event) {
    Token newToken = (Token) Event.getNewValue();
    Token oldToken = (Token) Event.getOldValue();
    if ((oldToken.getState() == Token.TOKEN_RESERVED)
    && (newToken.getState()== Token.TOKEN_AVAILABLE)) {
    String networkID = newToken.getNeID();
    asdlCache = AceCacheFactory.getCache("asdlCache");
    tokenCache = AceCacheFactory.getCache("tokenCache");
    EqualsFilter filterNE = new EqualsFilter(new PofExtractor(String.class,Asdl.NETWORKID), networkID);
    LimitFilter limitFilter = new LimitFilter(filterNE, PAGE_SIZE);
    Set removeASDL = asdlCache.keySet(limitFilter);
    Iterator asdlIterator = removeASDL.iterator();
    if (asdlIterator.hasNext()) {
    logger.info(printASDLCache());
    ValueUpdater updater = new PofUpdater(Token.STATE);
    System.out.println("Token ID:" + newToken.getTokenID());
    UpdaterProcessor updaterProcessor = new UpdaterProcessor(updater, Integer.toString(Token.TOKEN_RESERVED));
    tokenCache.invoke(newToken.getTokenID(), updaterProcessor);
    jcaBean = new JCAModeler(tokenCache);
    Object asdlID = asdlIterator.next();
    Asdl provisionAsdl = (Asdl) asdlCache.get(asdlID);
    asdlCache.remove(asdlID);
    jcaBean.provision(provisionAsdl, newToken.getTokenID());
    logger.info(ConnectionManager.printTokenCache());
    logger.info(printASDLCache());
    }

    Here is what I am asking!
    I have added 2 listeners (Listener A and Listener B) which each listen on for changes made to 2 different token Cache Objects (Token A and Token B).
    for (i = 0; i < 2 ; i++) {
    Token tokenAdded = new Token(UUID.randomUUID().toString(),TOKEN_AVAILABLE, networkID);
    tokenCache.put(tokenAdded.getTokenID(), tokenAdded);
         tokenCache.addMapListener((MapListener) new TokenCacheListener(), tokenAdded.getTokenID(), false);
    Now assume that updates are made to Token A and Token B simuntaneosly.
    Why do i observe in my diagnostic messages that only one Listener is invoked at a given point of time.
    Which means I see Listener A getting invoked and then once invocation of Listener A is complete I see Listener B bieng invoked.
    Ideally I would want both listeners to be invoked simultaneously rather than in a one off fashion.
    Here is the code for my token cache Listener
    package oracle.communications.activation.asap.ace;
    import java.util.Iterator;
    import java.util.Map;
    import java.util.Set;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import com.tangosol.net.CacheFactory;
    import com.tangosol.net.NamedCache;
    import com.tangosol.util.AbstractMapListener;
    import com.tangosol.util.Filter;
    import com.tangosol.util.MapEvent;
    import com.tangosol.util.MapListener;
    import com.tangosol.util.ObservableMap;
    import com.tangosol.util.ValueUpdater;
    import com.tangosol.util.extractor.PofExtractor;
    import com.tangosol.util.extractor.PofUpdater;
    import com.tangosol.util.filter.AndFilter;
    import com.tangosol.util.filter.EqualsFilter;
    import com.tangosol.util.filter.LikeFilter;
    import com.tangosol.util.filter.LimitFilter;
    import com.tangosol.util.processor.UpdaterProcessor;
    public class TokenCacheListener extends AbstractMapListener {
         NamedCache asdlCache;
         NamedCache tokenCache;
         AceCacheFactory cacheFactoryBean = new AceCacheFactory();
         private final int PAGE_SIZE = 1;
         private static Logger logger = Logger.getLogger(ConnectionManager.class
                   .getName());;
         * An instance of the JCAModeler EJB, represents the JCA-JNEP
         JCAModeler jcaBean;
         * This is a utility method and prints the tokens cache.
         public String printTokenCache() {
              NamedCache tokenCache = cacheFactoryBean.getCache("tokenCache");
              LikeFilter tokenList = new LikeFilter(new PofExtractor(String.class,
                        Token.STATE), "%", (char) 0, false);
              Set keySet = tokenCache.keySet(tokenList);
              StringBuffer cachedTokenList = new StringBuffer("\n################################## Token(s) Cache ##################################");
              int counter = 1;
              for (Object tokenInCache: keySet) {
                   Token tokenObject = (Token) tokenCache.get(tokenInCache.toString());
                   cachedTokenList.append("\nS.NO:" + (counter++)
                             + "\t ID:" + tokenInCache.toString()
                             + "\t State:" + Token.tokenToString(tokenObject.getState()));
              cachedTokenList.append("\n####################################################################################");
              return cachedTokenList.toString();     
         * This method is a utility method and it prints all the ASDL(s) currently present on the
         * asdlCache.
         private String printASDLCache() {
              NamedCache asdlCache = cacheFactoryBean.getCache("asdlCache");
              LikeFilter asdlList = new LikeFilter(new PofExtractor(String.class,
                                  Asdl.NETWORKID), "%", (char) 0, false);
              Set keySet = asdlCache.keySet(asdlList);
              StringBuffer cachedASDLList = new StringBuffer("\n################ ASDL Cache ######## ########");
              int counter = 1;
              for (Object asdlInCache: keySet) {
                   cachedASDLList.append("\nS.NO:" + (counter++) + "\t ID:" + asdlInCache.toString());
              cachedASDLList.append("\n################ ASDL Cache ######## ########\n");
              return cachedASDLList.toString();     
         public TokenCacheListener() {
         public void checkASDLCache(MapEvent Event) {
         // Not currently used
         public void entryUpdated(MapEvent Event) {
              Token newToken = (Token) Event.getNewValue();
              Token oldToken = (Token) Event.getOldValue();
              logger.info("\n=============================================================================================="
                        + "\nTOKEN CACHE LISTENER"
                        + "\n=============================================================================================="
                        + printTokenCache()
                        + "\n==============================================================================================");
              if ((oldToken.getState() == Token.TOKEN_RESERVED)
                        && (newToken.getState()== Token.TOKEN_AVAILABLE)) {
              String networkID = newToken.getNeID();
              asdlCache = cacheFactoryBean.getCache("asdlCache");
              tokenCache = cacheFactoryBean.getCache("tokenCache");
              EqualsFilter filterNE = new EqualsFilter(new PofExtractor(String.class,Asdl.NETWORKID), networkID);
              LimitFilter limitFilter = new LimitFilter(filterNE, PAGE_SIZE);
              Set removeASDL = asdlCache.keySet(limitFilter);
              Iterator asdlIterator = removeASDL.iterator();
              if (asdlIterator.hasNext()) {
              logger.info(printASDLCache());
              ValueUpdater updater = new PofUpdater(Token.STATE);
              System.out.println("Token ID:" + newToken.getTokenID());
              UpdaterProcessor updaterProcessor = new UpdaterProcessor(updater, Integer.toString(Token.TOKEN_RESERVED));
              tokenCache.invoke(newToken.getTokenID(), updaterProcessor);
              jcaBean = new JCAModeler(tokenCache);
              Object asdlID = asdlIterator.next();
              Asdl provisionAsdl = (Asdl) asdlCache.get(asdlID);
              asdlCache.remove(asdlID);
              jcaBean.provision(provisionAsdl, newToken.getTokenID());
              logger.info(printTokenCache());
              logger.info(printASDLCache());
    I only see one instance of this listener alive at any given point of time.
    Edited by: 807103 on Nov 3, 2011 1:00 PM
    Edited by: 807103 on Nov 3, 2011 1:12 PM

  • Acrobat 9 Pro Extended Distiller - Multi-threaded?

    I am using distiller on some fairly large postscript files (also large numbers of small postscript files) and am running into what appears to be machine limitations. I'm running on a 32 bit workstation with 3gb RAM and an intel core duo CPU. Looking at the perf monitor, my processes are not RAM limited and I never seem to get the CPU use above 50% which indicates to me that distiller may not be multi-threaded. Is that the case? If so, is there a way to get distiller to use both CPUs? (or all 4 on a quad core)

    I am also facing the same issue. Although you can run multiple instances of Distiller using switch "N"
    acrodist.exe -N
    But don't know how to distribute the watchedFolders among them.
    Even though you can specify the Watch Folders once the instances are up and running.. but in case if you close the instances and start them again.. only one instance will have all the watched folders with it.
    So don't know the solution to this, anyone pls help
    Thanks in Advance
    Naveen Sharma

  • Multi-threading

    Hi folks,
    I need to have one Connection object and multiple Statement objects created from this Connection Object. Is it safe to do this from a multi-threaded application?
    Does createStatement() destroy any previously created Statement?

    You can have multiple statements in different threads coming of the same connection.
    But, all such statements will be part of the same transacion. A DML in one thread will be reflected in a query in another thread.
    If this not what you wanted, then you can have a connection pool and get connections from it in the individual threads.

  • Multi-Threaded server using  ThreadPool

    Dear friends,
    I am writing a client-server program in which the client and server communicate using SUN-RPC. The client reads a file containing some numbers and then spawns threads which it uses to request the server for a service. These threads are executed using a thread pool. Till this time, it's working fine. But when it comes to the server, the real trouble begins because it too needs to be made a multi-threaded one using thread pooling. The server has to capture the call information for each request for the service and then pass this information to a thread/runnable object in whose run() method the code for execution of the service would be present. Since the tasks(requests for the service) are not present already, i am unable to execute the server side threads in a loop using a thread pool. How to solve this problem? Kindly help.
    Thanks,
    Subhash

    The server has to capture the call information for each request for the serviceWhy?
    and then pass this information to a thread/runnable object in whose run() method the code for execution of the service would be present.Why can't the run() method get the call information when it starts? That's what's normally done. The server's accept loop mustn't do any other I/O: otherwise a rogue client can block the server complete.y

  • Multi-Thread application and common data

    I try to make a multi-Thread application. All the Threads will update some common data.
    How could I access the variable �VALUE� with the Thread in the following code:
    public class Demo {
    private static long VALUE;
    public Demo(long SvId) {
    VALUE = 0;
    public static class makeThread extends Thread {
    public void run() {
    VALUE++;
    public static long getVALUE() {
    return VALUE;
    The goal is to get the �VALUE� updated by the Thread with �getVALUE()�
    Thanks for your reply
    Benoit

    That code is so wrong in so many ways......
    I know you're just experimenting here, learning what can and can't be done with Threads, but bad habits start early, and get harder to kick as time goes on. I am going to give a little explanation here about what's wrong, and what's right.. If you're going to do anything serious though, please, read some books, and don't pick up bad habits.
    Alright, The "answer" code. You don't use Thread.sleep() to wait for Threads to finish. That's just silly, use the join() method. It blocks until the threads execution is done. So if you have a whole bunch of threads in an array, and you want to start them up, and then do something once they finish. Do this.
    for(int k=0; k<threads.length; k++) {
      threads[k].start();
    for(int k=0; k<threads.length; k++) {
      threads[k].join();
    System.out.println("All Threads Done");Now that's the simple problem. No tears there.
    On to the java memory model. Here where the eye water starts flowing. The program you have written is not guarenteed to do what you expect it to do, that is, increment VALUE some amount of time and then print it out. The program is not "Thread Safe".
    Problem 1) - Atomic Operations and Synchronization
    Incrementing a 'long' is not an atomic operation via the JVM spec, icrementing an int is, so if you change the type of VALUE to an int you don't have to worry about corruption here. If a long is required, or any method with more then one operation that must complete without another thread entering. Then you must learn how to use the synchronized keyword.
    Problem 2) - Visiblity
    To get at this problem you have to understand low level computing terms. The variable VALUE will NOT be written out to main memory every time you increment it. It will be stored in the CPUs cache. If you have more then one CPU, and different CPUs get those threads you are starting up, one CPU won't know what the other is doing. You get memory overwrites, and nothing you expect. If you solve problem 1 by using a synchronized block, you also solve problem 2, because updating a variable under a lock will cause full visiblity of the change. However, there is another keyword in java.. "volatile".. A field modified with this keyword will always have it's changes visible.
    This is a very short explaination, barely scratching the surface. I won't even go into performance issues here. If you want to know more. Here's the resources.
    Doug Lea's book
    http://java.sun.com/docs/books/cp/
    Doug Lea's Site
    http://g.cs.oswego.edu
    -Spinoza

  • InfoPath: the multi-threading challenge

    Or to be more specific: calling a DataSource from a different thread.
    A project I'm working on includes an InfoPath form in which some heavy duty tasks are executed. These tasks can take over 10+ seconds to execute. To avoid the GUI to get stuck during execution, multi-threading is implemented. The problem lies in providing
    feedback to the user. Several methods have been used, but all end in the exceptions shown below.
    Unlike WinForms and such, InfoPath does not seem to provide a way to invoke the GUI. What we are trying to do is change field values to reflect the status of the process. This is done through the MainDataSource. I've tried several methods to call
    this datasource through another thread, like invoking a provided delegate, or execution context. However all these methods have similar results.
    When calling a method or property on the datasource the following exception is thrown:
    System.InvalidOperationException was unhandled
      Message="Operation is not valid due to the current state of the object."
      Source="Microsoft.Office.InfoPath.Client.Internal.Host"
      StackTrace:
           at Microsoft.Office.Interop.InfoPath.SemiTrust.ICLRExtensionsWrapper.IncrementSqmPoint(Int32 idDataPt)
           at Microsoft.Office.InfoPath.Internal.DataSourceHost.CreateNavigator()
           at Form1.FormCode.ContextCallbackMethod(Object obj) in E:\Projects\InfoPath Multithreading\Source\Form1\FormCode.cs:line 74
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at Form1.FormCode.ThreadMethod(Object myParamsObj) in E:\Projects\InfoPath Multithreading\Source\Form1\FormCode.cs:line 68
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart(Object obj)
    This seems to indicate the DataSource is locked for some reason. Even the ReadOnly property can not be read.
    When calling the SetValue method on an XPathNavigator provided by a datasource and passed through another thread, the following exception is thrown:
    System.AccessViolationException was unhandled
      Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
      Source="Microsoft.Office.InfoPath.Client.Internal.Host.Interop"
      StackTrace:
           at Microsoft.MsoOffice.InfoPath.MsxmlInterop.NativeHelpers.SetText(IXMLDOMNode* , Char* )
           at Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlNodeImpl.set_Text(String strText)
           at Microsoft.Office.InfoPath.MsxmlNavigator.SetValue(String value)
           at Form1.FormCode.DelegateMethod(XPathNavigator nav) in E:\Projects\InfoPath Multithreading\Source\Form1\FormCode.cs:line 81
           at Form1.FormCode.ThreadMethod(Object myParamsObj) in E:\Projects\InfoPath Multithreading\Source\Form1\FormCode.cs:line 70
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart(Object obj)
    I have searched through the internet but am unable to find any useful information about this subject. There are only a few weeks remaining before the deadline. A work-around has been implemented, but since it requires additional active user interaction
    it is far from ideal. I hope you can help me in finding a solution.

    For anyone who is still interested all this time later....
    I wouldn't use a Dispatcher in InfoPath simply because InfoPath requires .Net 2.0 only and Dispatcher was not added until .Net 3.0 which means you would have to enforce installation of .Net 3.0 yourself.
    There is an easy alternative which is SynchronizationContext (more specifically a WindowsFormsSynchronizationContext).
    Also I suggest you do not use ThreadStart but rather use one of the more modern and well known threading paradigms. A good alternative is a BackgroundWorker.
    e.g.
    private BackgroundWorker _Worker;
    public void InternalStartup()
    InitializeWorker();
    ((ButtonEvent)EventManager.ControlEvents["Button"]).Clicked += new ClickedEventHandler(ButtonClick);
    public void InitializeWorker()
    _Worker = new BackgroundWorker();
    _Worker.WorkerReportsProgress = true;
    _Rorker.WorkerSupportsCancellation = true;
    _Worker.DoWork += new DoWorkEventHandler(_Worker_DoWork);
    _Worker.ProgressChanged += new ProgressChangedEventHandler(_Worker_ProgressChanged);
    _Worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_Worker_RunWorkerCompleted);
    public void ButtonClick(object sender, ClickedEventArgs e)
    if (_Worker.IsBusy)
    _Worker.CancelAsync();
    else
    // Very important to include this line!
    AsyncOperationManager.SynchronizationContext = new WindowsFormsSynchronizationContext();
    _Worker.RunWorkerAsync();
    void _Worker_DoWork(object sender, DoWorkEventArgs e)
    // Do stuff in another thread and report back to the UI thread.
    object state;
    int percentage = 0;
    _Worker.ReportProgress(percentage, state).
    public void _Worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
    // This is called on the thread that started the worker.
    // In this case the UI thread which means it is safe to use the MainDataSource.
    CreateNavigator().SelectSingleNode("my:Main/my:Progress", NamespaceManager).SetValue(e.ProgressPercentage);
    void _Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
    // Do anything you want to do on completion here.
    One thing of note is that the SynchronizationContext in InfoPath for some reason or other always seems to be Null. The result is that when you call RunWorkerAsync() it captures the current synchronization context (null) which means the default is used and
    a ProgressChanged is called on a new thread each time. To prevent this we need to manually set the context before calling RunWorkerAsync() which is done using the AsyncOperationManager.

  • Using multi threading to access 2 RS232 ports

    Hi,
    I'm a beginner in multi threading, so this question may be a very basic one....
    I'm Using TS3.5 + CVI 8.01 to communicate withs 2 RS232 ports.  I thought to use mult threading so I can process 2 steps in parallel rather than in series. 
    This is what I do:
    1) I defined 2 subsequences, each of them call the same CVI function.  I use the sub sequence parameters to transfer the com number.
    2) My CVI application includes one dll for this specific project and another one, a general dll to handle RS232 functions.  The RS232 dll uses one global buffer than collects all the traffic on the com. 
    QUESTIONS:
    1) What happens when 2 seperate threads run the same function in the RS232 dll?  (in terms of memory etc...).  Does each one use a different buffer (in terms of memory allocation), or, both of them writes to the same buffer?   Obviously, if they writes to the same buffer, then, my function will not operate properly.
    2) What happens in TestStand after the 2 steps in new threads have finished their execution?  does the next step run back in the same threads the sequence run before?
    Thanks
    Rafi

    Rafi,
    Glad to hear you were able to make some ground on your application. As for all of your questions, I'll try to answer as many as I can.
    First, when you are talking about your global buffer, is it created in TestStand or in the DLL itself? When you use DLLs, global variables or global structures are shared between all threads that call your DLL. On the other hand, if your buffer is declared inside of the DLL it is global for the DLL but not shared and would be a separate buffer for each call.
    With your run-time error in TS, it would definitely be helpful to have more information about the error. From what you explained (executing fine on the first call, but failing on future executions), it sounds like the resource is not being released after the first execution.
    As far as a specific example for TestStand Multithreading, you'll want to look at the TestStand Development Library and, specifically, Multithreading in TestStand. If you look and browse through the Application Notes and Tutorials section, as well as the Technical Presentations section, you will learn a great deal about multithreading and what options you have in TestStand. For a specific example, you may want to look at This Example. You could also look in the <TestStand>\Examples (where <TestStand> is the directory where TS is installed) at the MultiUUT example for an example of multithreading in TS. These examples may not be exactly what you need, but they should give you a jump start.
    As far as making your DLL multithread safe, it is definitely not necessary; however, there are some significant advantages described in this article: Designing Thread-Safe DLLs. It is an MSDN article that focuses on Visual Basic, but it has some helpful information that can apply to C as well.
    Hopefully this can help you move further. I have attached a list of links at the end of this post with other helpful links for you as well. Keep us posted with your progress.
    Matt Mueller
    NI
    Links:
    General Information on Multithreading for C Programmers
    Building Multithreading Applications with LabWindows/CVI
    Multithreading in LabWindows/CVI
    Easy Multithreading Programming in LabWindows/CVI
    Multithreading for Rookies

  • Analysis for Office support multi thread?

    Does Analysis for Office support multi thread/core? If so, what verison? I tried searching around this site as well as note 1466118 - Hardware & Software requirements for Analysis, edition for MS Office but was unable to find an answer.
    I am on an Intel dual cpu with hyper threading turned on so it essentially looks like 4 cores. When I execute an Analysis View, I rarely see the EXCEL.EXE process go above 25% CPU utilization. I have plenty of RAM and hard drive space.
    64bit Windows 7
    32bit Office 2010
    AAO 1.3.5.2288
    Thanks

    I found the following info at:
    Excel 2010 Performance: Performance and Limit Improvements
    Large Data Sets and 64-bit Excel
    The 64-bit version of Excel 2010 is not constrained to 2 GB of RAM like 32-bit applications. Therefore, 64-bit Excel 2010 enables users to create much larger workbooks. 64-bit Windows enables a larger addressable memory capacity, and 64-bit Excel is designed to take advantage of that capacity. For example, users are able to fill more of the grid with data than was possible in previous versions of Excel. As more RAM is added to the computer, Excel uses that additional memory, allows larger and larger workbooks, and scales with the amount of RAM available.
    In addition, because 64-bit Excel enables larger data sets, both 32-bit and 64-bit Excel 2010 introduce improvements to common large data set tasks such as entering and filling down data, sorting, filtering, and copying and pasting data. Memory usage is also optimized to be more efficient, in both the 32-bit and 64-bit versions of Excel.
    Multi-Core Processing
    Additional investments were made to take advantage of multi-core processors and increase performance for routine tasks. Starting in Excel 2010, the following features use multi-core processors: saving a file, opening a file, refreshing a PivotTable (for external data sources, except OLAP and SharePoint), sorting a cell table, sorting a PivotTable, and auto-sizing a column.
    For operations that involve reading and loading or writing data, such as opening a file, saving a file or refreshing data, splitting the operation into two processes increases performance speed. The first process gets the data, and the second process loads the data into the appropriate structure in memory or writes the data to a file. In this way, as soon as the first process beings reading a portion of data, the second process can immediately start loading or writing that data, while the first process continues to read the next portion of data. Previously, the first process had to finish reading all the data in a certain section before the second process could load that section of the data into memory or write the data to a file.

  • The problem about multi-thread in java application

    i have problem with the multi-thread in java application, i don't know how to stop and restart a thread safely, because the function thread.stop(),thread.suspend() are both deprecated.
    now what i can only do is making the thread check a flag(true or false) to determine whether to start or to stop, but i think this thread will always be in the memory and maybe it will lower the performance of the system, as the program i am developping is working under realtime enviorement.
    please help me about it. thanks !

    hi,
    you can stop a thread by exiting it's run()-method which in terms can be done by checking the interrupted-flag:
    public void run(){
    while(interrupted()){ //if the thread consists of a loop
    or
    public void run(){
    if(interrupted())return;
    if(interrupted())return;
    or by the use of the return-statement anywhere withing the run-method. Afterwards, that is when the thread is no longer needed, you clear all the references to the specific thread object by setting them to null:
    Thread t;
    ... //working
    t.interrupt(); //interrupting
    while(t.isAlive()){
    Thread.yield(); //wait till thread t has stopped
    t=null;
    best regards, Michael

  • Multi-threaded server programming

    Hello, I meet a problem and don't know how to solve it: I have created a multi-threaded server program which receives multiple users from their own PCs. The server program receives users'commands and echo it back to all users who are currently connecting to my server. I store every clientSocket connecting to my server into a vector. My question is: how the server broadcasts a user command to other users? And how the server knows to which user he will echo the command to since the hostName and port number are the same to every user currently connecting to my server? Thanks a lot.

    You should look at extending the Socket class to encorporate user details. Either use what peter suggested or make the user pass a username (or something) when they connect.
    When you want to broadcast to all users just enumerate through your vector and send each one the command. If you mean the user performs a task on their application and you want to produce the same results in all the other users apps then its down to you to code it. When user1 clicks on a button the app must send a command (eg. a string) to the server which sends the same string to all other users. When the user receives this string it performs some task.
    Is that what you mean?
    Ted.

  • Multi threaded programming

    I am quite new to multi threaded programming.
    The problem I am facing in my code is as follows:
    I can instantiate 1-10 threads from my controller class. For example if my controller class generates 10 threads, 5 threads
    finish the task they are assigned to do(i.e send SMS and Update the Database) and the other 5 threads eventhough send SMS but
    get stuck when they are supposed to update the Database (this is inferred from the logs).
    Due to this problem my controller class remains in a wait state as I am using the join() method and some of the threads never
    join.
    Another interesting observation is that it always happens that the thread numbered 0-5 always get stuck at the exact point
    where database has to be updated and thread number 6-10 complete their task. Same is the case when i instantiate 2 threads, i
    thread completes its task and another thread gets stuck, again at the same point.
    I am using Connection Pooling to connect to the database.
    I am sure that the problem is with the query
    int j=dbObject.execute_pst("UPDATE table SET flag='true' WHERE message IN("+trueFlag+")",con);
    where true flag is a comma seperated string containing some ID's.
    What i cannot understand is why some of the threads (almost 50% of them), work fine with this query and the others get stuck
    (i.e. just wait at this query during runtime)

    The problem must lie in the connection, as the SQL statement is to basic to cause an endless loop inside the DBMS. If you are in doubt, try the setMaxRows() method of the Statement interface, I'm using Sybase and it also limits the number of rows processed in update and delete statements (which I'm pretty sure is buggy, but you can still try it).
    Which DBMS are you using by the way?

Maybe you are looking for

  • SVN Connection problem in JDeveloper

    Iam using Jdeveloper 10.1.3 . I did as given in http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/subversion/subversion.html Updated JDeveloper with Subversion VCS extension Installed SVN Version 1.3.2 Created Repository

  • How can I install my Officejet 100 Mobile Printer Driver on my Motorola Photon 4G Cell Phone?

    The Photon is an Android phone and does not run on widows or mac operating system. HP instructions are as follows: NOTE:The print application software must be installed on your phone before you can print to the HP product. See the phone manufacturer'

  • What happens if I delete CalDAV in iCal? I'm getting a persistent error message

    What happens if I delete CalDAV in iCal? I'm getting a persistent error message that says something like the server doesn't recognize my account or username, or some such thing. Background: This all started after I (a) decided to try a free trial of

  • Default Connection Object in EJB

    When we use default connection to get a connection to the oracle database through a deployed EJB, it uses the internal driver or in short it returns the same connection object. Is this connection object synchronized and thread safe. I mean if multipl

  • NetBeans 4.1, JWSDP 1.6, Tomcat 5.0-JWSDP

    Hello, I installed JWSDP 1.6 and Tomcat 5.0-JWSDP. Then with Netbeans 4.1 created Web application with very simple WebService (by NB "wizard", name of WS was ChristmasService) and after small patch I built war succesfully. (There is needed to specify