Using Multiple Threads

I'm pretty new to Java and am currently working on this assignment for one of my classes:
The goal is to create a program that will transfer an audio file using TCP/IP from a server to a client, then play the audio file. Additionally they wanted variable buffer sizes to measure the communication times when the buffer is changed. 've got all those parts complete (and good lord it took me days). The next step is to complete the same process, but begin playing the file before all the packets have been received by the client. That's where I'm stuck. Is a separate thread the way to go? If so, any suggestions on how to make that work would be appreciated.
Currently I'm dumping all the data into a ByteArray once it's been received, but I'm suspecting this won't work for real time streaming. Am I right in thinking this, and if that's the case, are PipedOutputStreams the solution? (And if they are, how do I pass values like that between threads?)
Below is the portion of code on the client side that works for transfer and play, but not for streaming.
Thanks in advance for any assistance.
<<<CODE>>>
//Setup data repository and transfer data to the array
byte[] byteData = new byte[byteCount];
int t=0;
double startTime = System.currentTimeMillis(); //Begin transfer time counter
while(t!=byteCount){
byteData[t]=inFromServer.readByte(); //Receive data
t++;
double endTime = System.currentTimeMillis() - startTime; //Calculate transfer time
System.out.println("Total Delay Time: " + endTime/1000 + " seconds");
//Stream the data into a byte array, set audio format, and setup the dataline
ByteArrayInputStream arrayStream = new ByteArrayInputStream(byteData,0,byteCount);
AudioInputStream audioStream = AudioSystem.getAudioInputStream(arrayStream);
AudioFormat audioFormat = audioStream.getFormat();
System.out.println("Now Playing: " + audioFormat);
DataLine.Info dataLineInfo = new DataLine.Info(SourceDataLine.class,audioFormat);
SourceDataLine sourceDataLine = (SourceDataLine) AudioSystem.getLine(dataLineInfo);
sourceDataLine.open(audioFormat);
sourceDataLine.start();
//Transfer data to the audio source dataline and play
int counter;
while((counter = audioStream.read(byteData,0,byteData.length)) != -1){
if(counter >0)
sourceDataLine.write(byteData,0,counter);
sourceDataLine.drain();
sourceDataLine.close();

Well nix that I managed to have a breakthrough and got things working. =)
Cheers!

Similar Messages

  • How do i use multiple threads( very much real time), using JavaFX?

    I'm creating an application, using JavaFX because one can create awesome GUI using JavaFX. I need to know how to create real time multiple threads using javafx.
    JavaFX doesn't support creation of multiple threads, but i think there is another way of doing it. I need it work in real time as my application works with an hardware (wacom intous 3 tablet), and i need mutiple threads to get all the parameters from the stylus of the tablet simultaneously...
    any code which will help me out or explaination on how to go about this is appreciated...
    Help required quickly...

    See example at
    [http://jfxstudio.wordpress.com/2009/06/09/asynchronous-operations-in-javafx/|http://jfxstudio.wordpress.com/2009/06/09/asynchronous-operations-in-javafx/]

  • How to use multiple threads and swing for displaying status/interaction

    I have a Swing-app which have to show progress and allow userinteraction for these tasks:
    * First:
    retrieve a list of IDs(String) from the database (single thread running)
    * Second:
    some work on the id-list and list written to hd (same thread as above)
    * Third:
    retrieve Objects (based on the id-list) from different sources (Multiple Threads are running)
    To show the status I have a JProgressBar (indeterminate while task1&2 running) and
    a JTextArea showing the current status (connect,retrieve list, sort, ...)
    When task3 is starting the JTextArea have to disappear and be replaced by a ScrollPane
    with an array of Labels/TextAreas showing the status of each thread.
    While theses threads are working, the ID-list will be consumed and the JProgressBar
    shows the remaining precentage of the hole progress.
    Everything is working so far (excepts UI :) , the problem(s) I have:
    I need the threads to interacts with the user through the ui. e.g: "Connection to db-xyz lost! reconnect?"
    But I don&#180;t know how to do this correctly.
    I think one way would be to send an event to the ui... but how?
    (the ui must know which thread is calling to unpause it after user answered)
    I know that threads should NOT change the swing(-container) - How do I notify the ui that a thread has a question?
    Since these threads are really time-consuming the UI is not updated frequently,
    how can I increase this? (perhaps using another thread-priority?)
    thanks for help!

    if/when your threads need to interact with the UI, they can create a Runnable & send it to SwingUtilities.invokeLater or invokeAndWait. This Runnable can popup a message to the user, and act on the choice of the user (reconnect, cancel, ...). This action could be something which "unpauses" the task thread.
    You may need to do synchronisation between the code in the Runnable & the Thread to which it is related - so the latter Thread knows when the user has made the choice.

  • Is there any problem to use multiple threads to send email with JavaMail

    Dear all,
    I am using JavaMail 1.3.2 to send emails with SMTP, it works very well for a long time.
    But one day, I found that the email service hanged and I could never send email again until I restart the tomcat. I found that the reason was a deadlock had been created, the required resource for sending email had not been released.
    I guess the error is due to multiple threads are sending email at the same time. I made a test to create seperate thread for sending each email. After few days, I found this deadlock happened again. So, my question is: Can I use JavaMail with multiple threads? If not, I may need to sychronized all the thread that using JavaMail. I would like to make sure this is the reason for causing the deadlock problem.
    Here is part of my code for using JavaMail:
    transport = session.getTransport("smtp");
    transport.connect(email_host, smtp_user, smtp_pass);
    message.saveChanges();
    transport.sendMessage(message,message.getAllRecipients());
    which is very standard call, and it worked well for a long time.
    Here is part for my thread dump on tomcat:
    (Thread-339)
    - waiting to lock <0x5447c180> (a sun.nio.cs.StandardCharsets)
    (Thread-342)
    - locked <0x5447c180> (a sun.nio.cs.StandardCharsets)
    It seems that these happened after call the method transport.sendMessage() or message.updateChanges()
    , and the underlying implementation may require the JRE StandardCharsets object. But the object had been locked and never be released. So, the sendMessage() or updateChanges() can't be completed.
    Please give me some helps if you have any idea about it.
    Thanks very much!
    Sirius

    Note that the Nightly build gets updated daily (and sometimes more than once in case of a respin) and it is always possible that something goes wrong and it doesn't work properly, so be prepared for issues if you decide to stay with the Nightly build and make sure to have the current release with its own profile installed as well in case of problems.
    See also:
    * http://kb.mozillazine.org/Testing_pre-release_versions
    *http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows
    *http://kb.mozillazine.org/Shortcut_to_a_specific_profile
    *http://kb.mozillazine.org/Using_multiple_profiles_-_Firefox

  • Client/Server in one program (using multiple threads)?

    Is there some examples out there of how to use a client and server in a single program using separate threads? Also, is it possible to start a third thread to control the packets, such as drop a random or specified number of packets (or match on specific data in a packet)?

    Just trying to have a client send udp packets to a server (all on the same machine running from the same program) and want to be able to drop packets coming from the client side to the server side.
    E.g.,
    Here's an example that I found here: http://compnet.epfl.ch/tps/tp5.html
    import java.io.<strong>;
    import java.net.</strong>;
    import java.util.<strong>;
    /</strong>
    * Server to process ping requests over UDP.
    public class PingServer {
         private static double lossRate = 0.3;
         private static int averageDelay = 100; // milliseconds
         private static int port;
         private static DatagramSocket socket;
         public static void main(String[] args) {
              // Get command line arguments.
              try {
                   if (args.length == 0) {
                        throw new Exception("Mandatory parameter missing");
                   port = Integer.parseInt(args[0]);
                   if (args.length > 1) {
                        lossRate = Double.parseDouble(args[1]);
                   if (args.length > 2) {
                        averageDelay = Integer.parseInt(args[2]);
              } catch (Exception e) {
                   System.out.println("UDP Ping Server");
                   System.out.println("Usage: java PingServer port [loss rate] [average delay in miliseconds]");
                   return;
              // Create random number generator for use in simulating
              // packet loss and network delay.
              Random random = new Random();
              // Create a datagram socket for receiving and sending UDP packets
              // through the port specified on the command line.
              try {
                   socket = new DatagramSocket(port);
                   System.out.println("UDP PingSever awaiting echo requests");
              } catch (SocketException e) {
                   System.out.println("Failed to create a socket");
                   System.out.println(e);
                   return;
              // Processing loop.
              while (true) {
                   // Create a datagram packet to hold incoming UDP packet.
                   DatagramPacket request = new DatagramPacket(new byte[1024], 1024);
                   // Block until the host receives a UDP packet.
                   try {
                        socket.receive(request);
                   } catch (IOException e) {
                        System.out.println("Error receiving from socket");
                        System.out.println(e);
                        break;
                   // Print the received data.
                   printData(request);
                   // Decide whether to reply, or simulate packet loss.
                   if (random.nextDouble() < lossRate) {
                        System.out.println("   Reply not sent.");
                        continue;
                   // Simulate network delay.
                   try {
                        Thread.sleep((int) (random.nextDouble() * 2 * averageDelay));
                   } catch (InterruptedException e) {}; // Ignore early awakenings.
                   // Send reply.
                   InetAddress clientHost = request.getAddress();
                   int clientPort = request.getPort();
                   byte[] buf = request.getData();
                   DatagramPacket reply = new DatagramPacket(buf, buf.length,
                             clientHost, clientPort);
                   try {
                        socket.send(reply);
                   } catch (IOException e) {
                        System.out.println("Error sending to a socket");
                        System.out.println(e);
                        break;
                   System.out.println("   Reply sent.");
          * Print ping data to the standard output stream.
         private static void printData(DatagramPacket request) {
              // Obtain references to the packet's array of bytes.
              byte[] buf = request.getData();
              // Wrap the bytes in a byte array input stream,
              // so that you can read the data as a stream of bytes.
              ByteArrayInputStream bais = new ByteArrayInputStream(buf);
              // Wrap the byte array output stream in an input stream reader,
              // so you can read the data as a stream of characters.
              InputStreamReader isr = new InputStreamReader(bais);
              // Wrap the input stream reader in a buffered reader,
              // so you can read the character data a line at a time.
              // (A line is a sequence of chars terminated by any combination of \r
              // and \n.)
              BufferedReader br = new BufferedReader(isr);
              // We will display the first line of the data.
              String line = "";
              try {
                   line = br.readLine();
              } catch (IOException e) {
              // Print host address and data received from it.
              System.out.println("Received echo request from "
                        + request.getAddress().getHostAddress() + ": " + line);
    }I'm looking to do the "processing loop" in a separate thread, but I'd also like to do the client in a separate thread
    So you're saying, just put the client code in a separate class and start the thread and that's it? As far as the packet rate loss thread, is this possible to do in another thread?

  • Modifying the stack class to use multiple threads

    Im trying to re write the stack class but with using 2 threads. One of the thread calls the pop method and the other calls the push method.
    I don't know where im going wrong...
    Any tips would be great thnx
    Haven't bothered putting in any try / catch clauses yet, will make it look pretty later :)
    http://nopaste.php-q.net/19555

    java.util.Stack is thread safe so all you need to do are create two threads
    one which pushes data onto the stack and one which pops it off.
    class PushThread implements Runnable {
       private Stack stack;
       public PushThread(Stack s) {
          this.stack = s;
       public void run() {
         while(true) { // loop for ever
            stack.push(new Object());
            for(int i=0;i<100000;i++); // waste some time.
    }The code above deliberatly does not use wait, sleep, notify etc as these
    would force an ordering onto the stack. The code instead goes into a
    loop that should waste time.
    your PopThread class will be identical but will call stack.pop() instead.
    matfud

  • How to decrease CPU usage when using multiple threads?

    I am using vb.net , .NetFramework 2.0 . 
    My application gets live stock prices from google and updates stocks in database each 10 seconds.
    I get this code for  multithreading. When application starts updating stocks in database(about 200 stocks) , the update takes up to 3 seconds but it increase CPU usage from 10 % to 70 % or 80 %.
    What is the best way to to update database without getting CPU increase to high level?
    I observed that all threads works at the same time. how to make each thread wait until the second ends?
    This is my code. The problem is in function updateThreaded2().
    Please I need quick help. Thanks
    Public Function Update2(ByVal l As SortableBindingList(Of NewStockList)) As Long
    res = 0
    UThread = New System.Threading.Thread(AddressOf UpdateThreaded2)
    If Me.URunning = True Then
    Else
    Try
    Me.URunning = True
    Interlocked.Exchange(Me.UCount, 0) 'threadsafe method of assigning static value
    Interlocked.Exchange(Me.UDone, 0) 'threadsafe method of assigning static value
    UThread.Priority = Threading.ThreadPriority.BelowNormal
    UThread.IsBackground = True
    UThread.Start(l)
    Return 0
    Catch ex As Exception
    End Try
    End If
    End Function
    Private Sub UpdateThreaded2(ByVal l As SortableBindingList(Of NewStockList))
    Dim i As Integer = 0
    Dim threadcount As Integer = Math.Min(Me.MaxThreads, Me.Stocks.Count)
    Dim threads(threadcount - 1) As SUTC
    Try
    While i < Me.Stocks.Count
    For j As Integer = 0 To threadcount - 1
    If threads(j) Is Nothing Then
    If i < Me.Stocks.Count Then
    threads(j) = New SUTC(Me.Stocks(i), Me.DefaultService, AdjustSplits, Use20Minutes, l)
    threads(j).Thread.Priority = Threading.ThreadPriority.BelowNormal
    threads(j).Thread.IsBackground = True
    threads(j).Thread.Start()
    i += 1
    End If
    ElseIf threads(j).UpdateState = 0 Then
    If i < Me.Stocks.Count Then
    SecUpd(j) = Me.Stocks(i).symbol
    threads(j) = New SUTC(Me.Stocks(i), Me.DefaultService, AdjustSplits, Use20Minutes, l)
    threads(j).Thread.Priority = Threading.ThreadPriority.BelowNormal
    threads(j).Thread.IsBackground = True
    threads(j).Thread.Start()
    i += 1
    End If
    End If
    Next
    Dim running As Boolean = True
    While running
    For j As Integer = 0 To threadcount - 1
    If threads(j).UpdateState = 0 Then
    Thread.Sleep(10)
    running = False
    SecUpd(j) = ""
    Interlocked.Increment(UDone) 'threadsafe method of incrementing a variable by 1
    Interlocked.Exchange(UCount, UCount + threads(j).UpdateCount) 'Threadsafe method for assigning a value
    End If
    Next
    End While
    End While
    Dim pending As Integer = threadcount
    Dim tempcount As Integer = 0
    Dim oldcount As Integer = UCount
    While pending > 0
    pending = threadcount
    tempcount = 0
    For i = 0 To threadcount - 1
    If threads(i).UpdateState = 0 Then
    SecUpd(i) = ""
    pending -= 1
    tempcount += threads(i).UpdateCount
    Thread.Sleep(10)
    End If
    Next
    Interlocked.Exchange(UDone, Me.Stocks.Count - pending) 'Threadsafe method for assigning a value
    Interlocked.Exchange(UCount, oldcount + tempcount) 'Threadsafe method for assigning a value
    End While
    Me.URunning = False
    Catch ex As System.Threading.ThreadAbortException 'handle abort correctly
    Dim pending As Integer = threadcount
    Dim tempcount As Integer = 0
    Dim oldcount As Integer = UCount
    While pending > 0
    pending = threadcount
    tempcount = 0
    For i = 0 To threadcount - 1
    If threads(i).UpdateState = 0 Then
    SecUpd(i) = ""
    pending -= 1
    tempcount += threads(i).UpdateCount
    End If
    Next
    Interlocked.Exchange(UDone, Me.Stocks.Count - pending) 'Threadsafe method for assigning a value
    Interlocked.Exchange(UCount, oldcount + tempcount) 'Threadsafe method for assigning a value
    End While
    End Try
    End Sub

    When the market is opened, stock prices changed every 500 ms . You can see this change on google finance.
    I figured as much, but my thoughts are that if you can somehow find a way to make your program more event driven, then it may be possible to reduce unnecessary looping...
    “If you want something you've never had, you need to do something you've never done.”
    Don't forget to mark
    helpful posts and answers
    ! Answer an interesting question? Write a
    new article
    about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

  • When to acknowledge when dispatching using multiple threads?

    So on a project I'm working on I read from a queue and I dispatch to a thread pool that has worker threads and the general idea is that I never want to acknowledge a message until I know for sure that I've processed it otherwise it risks becoming lost.
    There are two approaches
    1. is to acknowledge the message immediately after the details have been written to a working table and then in the event that the client restarts you pickup messages from this table prior to processing any new ones from the queue. upon processing each message you update it's state or delete the row from this table to reflect that it's no longer working.
    2. another approach is to queue up acknowledgements in the main message listener thread such that as each worker thread completes it's job it enqueues the message for acknowledge by the main delivery thread (async). ie. the same thread that is picking up the messages. So after pulling a message from the queue and having dispatched it you then at the end of the cycle work thru the queue to acknowledge the messages that has been queued up by the worker threads to be acknowledged. One thing about this is that acknowleding a message implicitly acknowledges all those prior unacknowledged messages it's probably overkill to be acknowledging every message in the "queue." You just want to acknowledge the most recent one.
    I believe that option 2 results in less work since there's no round trips to the database necessary to maintain a working table.
    Websphere's MQ in JMS requires that you acknowledge in the delivery thread so unless you do it immediately or after processing each message you have to maintain a working table if you want to guarantee that any message pulled off the queue was actually processed and not lost along the way.

    steffi wrote:
    So on a project I'm working on I read from a queue and I dispatch to a thread pool that has worker threads and the general idea is that I never want to acknowledge a message until I know for sure that I've processed it otherwise it risks becoming lost.
    There are two approaches
    1. is to acknowledge the message immediately after the details have been written to a working table and then in the event that the client restarts you pickup messages from this table prior to processing any new ones from the queue. upon processing each message you update it's state or delete the row from this table to reflect that it's no longer working.
    2. another approach is to queue up acknowledgements in the main message listener thread such that as each worker thread completes it's job it enqueues the message for acknowledge by the main delivery thread (async). ie. the same thread that is picking up the messages. So after pulling a message from the queue and having dispatched it you then at the end of the cycle work thru the queue to acknowledge the messages that has been queued up by the worker threads to be acknowledged. One thing about this is that acknowleding a message implicitly acknowledges all those prior unacknowledged messages it's probably overkill to be acknowledging every message in the "queue." You just want to acknowledge the most recent one.
    I believe that option 2 results in less work since there's no round trips to the database necessary to maintain a working table.certainly. but how exactly does it achieve your reliability goals from the first paragraph?
    Websphere's MQ in JMS requires that you acknowledge in the delivery thread so unless you do it immediately or after processing each message you have to maintain a working table if you want to guarantee that any message pulled off the queue was actually processed and not lost along the way.sounds about right, yes.

  • Will using multiple threads get me my curry in a hurry?

    Mr. Singh says no, but I say otherwise. What say you all?
    http://blogs.phillynews.com/inquirer/foodanddrinq/2007/12/you_cant_hurry_curry.html
    Just a minor diversion from ongoing production issues...
    :-(

    Well nix that I managed to have a breakthrough and got things working. =)
    Cheers!

  • PrinterException when multiple threads try to print report using JRC

    Iam using Crystal Report's JRC for printing reports, it works fine.
    But the problem araises when i use multiple threads.
    I used the following:
    reportClientDocument.getPrinterOutputController().printReport(.....); to print.
    I get the following exception
    Caused by: java.awt.print.PrinterException: No printer named "\\ch03\printer05" could be found.
    Without multiple thread it works fine.
    I have been scratching my head for days on this problem, any help is very much appreciated..

    If an API doesn't specifically say that it is thread safe then it isn't likely to be thread safe and the only way to approach it is to assume that it isn't.

  • How to proces the record in Table with multiple threads using Pl/Sql & Java

    I have a table containing millions of records in it; and numbers of records also keep on increasing because of a high speed process populating this table.
    I want to process this table using multiple threads of java. But the condition is that each records should process only once by any of the thread. And after processing I need to delete that record from the table.
    Here is what I am thinking. I will put the code to process the records in PL/SQL procedure and call it by multiple threads of Java to make the processing concurrent.
    Java Thread.1 }
    Java Thread.2 }
    .....................} -------------> PL/SQL Procedure to process and delete Records ------> <<<Table >>>
    Java Thread.n }
    But the problem is how can I restrict a record not to pick by another thread while processing(So it should not processed multiple times) ?
    I am very much familiar with PL/SQL code. Only issue I am facing is How to fetch/process/delete the record only once.
    I can change the structure of table to add any new column if needed.
    Thanks in advance.
    Edited by: abhisheak123 on Aug 2, 2009 11:29 PM

    Check if you can use the bucket logic in your PLSQL code..
    By bucket I mean if you can make multiple buckets of your data to be processed so that each bucket contains the different rows and then call the PLSQL process in parallel.
    Lets say there is a column create_date and processed_flag in your table.
    Your PLSQL code should take 2 parameters start_date and end_date.
    Now if you want to process data say between 01-Jan to 06-Jan, a wrapper program should first create 6 buckets each of one day and then call PLSQL proc in parallel for these 6 different buckets.
    Regards
    Arun

  • Help with running multiple threads

    I'm new to programming with threads. I want to know how to run
    multiple threads at the same time. Particularly for making games
    in Java which I'm also begining to learn. For running multiple
    threads at the same time, do you have to put two run() methods
    in the source? If not then how do you make two threads or more
    run at the same time?
    Thanks for helping.

    For running multiple
    threads at the same time, do you have to put two run()
    methods
    in the source? Hi there,
    Each thread is presumably performing a task. You may be performing the same task multiple times or be performing different tasks at once. Either way, each task would typically be contained within the run() method of a class. This class would either be a subclass of java.lang.Thread (extends Thread) or would be an implementation of java.lang.Runnable (implements Runnable). In either case, you would define a method with signature (public void run()...). The difference comes into play when you wish to actually perform one of these tasks. With a subclass of Thread, you would simply perform:
    new MyTask().start();
    With an implementation of Runnable, you would do this:
    new Thread(new MyTask()).start();
    This assumes you don't need to monitor the threads, won't be sending any messages to your tasks or any such thing. If that were the case, you would need to tuck away those returns to new MyTask() for later access.
    In order to launch two threads simultaneously, you would have something along the lines of:
    new MyTask().start();
    new MyOtherTask().start();
    Now it is perfectly possible that MyTask() would complete before MyOtherTask() managed to start in which case it wouldn't appear as if you had actually had multiple threads running, but for non-trivial tasks, the two will likely overlap. And of course, in a game, these tasks would likely be launched in response to user input, which means that you wouldn't have any control over when or in what order they executed.
    Anyhow, it's as simple as that. You should also consider following the Java Threading trail which shows a simple example of using multiple threads. You can find it at:
    http://java.sun.com/docs/books/tutorial/essential/threads/index.html
    Regards,
    Lynn

  • SQL Toolkit crashing with multiple threads

    Hello everyone and Happy New Year!
    I was hoping someone might be able to shed some light on this problem. I am updating an older application to use multiple threads. Actually the thread that is causing a problem right now is created by using an Asynchronous timer.
    I am using CVI 2010, and I think the SQL toolkit is version 2.2.
    If I execute an SQL statement from the main thread, there is no problem.
    stat = DBInit (DB_INIT_MULTITHREADED);
    hdbc = DBConnect( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sample.mdb;Mode=ReadWrite|Share Deny None" );
    hstmt = DBActivateSQL( hdbc, "SELECT * FROM SAMPLES" );
    DBDeactivateSQL(hstmt);
    DBDisconnect(hdbc);
    If I add code to do the same functions in a timer callback, it causes a stack overflow error.
    .. start main thread
    stat = DBInit (DB_INIT_MULTITHREADED);
    NewAsyncTimer (5.0, -1, 1, &gfn_quicktest, 0);
     .. end main thread
    .. and then the timer callback
    int CVICALLBACK gfn_quicktest (int reserved, int timerId, int event, void *callbackData, int eventData1, int eventData2)
    int hdbc = DBConnect( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=params\\sample.mdb;Mode=ReadWrite|Share Deny None" );
    int hstmt = DBActivateSQL( hdbc, "SELECT * FROM SAMPLES" );
    DBDeactivateSQL(hstmt);
    DBDisconnect(hdbc);
    return 0;
    The program crashes with a stack overflow error when the DBActivateSQL statement is called.
    I understand that the ODBC driver for Access may not support multithreading, but I am only connecting to that database from the same thread with those 2 statements only so it should be fine ?
    Any insight would be appreciated,
    Thanks,
    Ed.
    Solved!
    Go to Solution.

    I just tried this using the sample access database that comes with CVI. It uses a DSN instead of mdb. It worked fine though. I don't see any reason multithreading would be a problem here if you are opening and closing the connection in the same code segment. I do notice that you are using params in the asyn callback connection string. Where does this come from? Maybe try using the sample database and see if that works.
    National Instruments
    Product Support Engineer

  • Problem using multiple contexts in same thread

    Hello,
    I am having problem using multiple contexts in the same thread. Here is the scenario:
    front-end is calling a ejb1 with a user1 and password. Ejb1 is then calling ejb2
    using user2 and password. I am getting security exception when calling ejb2 with
    the message user1 is not authorized. Looking at the documentation, context 2 should
    be pushed on stack on top of context 1 and context 2 should then be used until
    context.close() is called. It looks like this is not the case in this scenario?
    Regards,
    Jeba Bhaskaran

    I have the GTX670. So pretty much the same.
    When I go to  Edit>Preferences>Playback I see:
    When I select the monitor I am not currently using for Premiere Pro, the Program Monitor shows up full size at 1920X1080 in that monitor.
    While that may not help you, at least you know a similar card can do the job and you know that it should work.. What happens if you drop down to two monitors? Will it work then?
    Also, have you performed the hack that allows Premiere Pro to use the card since that card is not in the file? I have no idea if that is relevant at all, by the way. It is just an attempt at getting our systems to work the same way.

  • Can multiple threads use same transaction concurrently?

              Is it possible that same transaction is being used by multiple threads concurrently
              in WLS? If each thread is doing suspend and resume how does it work? Does the
              transaction implementation support it? Is there a way to do it?
              

    Why you don't tell us some more about your application?
              I'm assuming this is a relatively long running transaction if run
              serially. One common solution is to break this type of workflow into
              several separate transactions with queues between them.
              -- Rob
              Karambir Singh wrote:
              > Is there any workaround for this? I mean to something like explicitly associating
              > the txn with user created threads.
              >
              > "krishna" <[email protected]> wrote:
              >
              >>Transaction context cannot be propagated to user created Threads.
              >>-Krishna
              >>"Karambir Singh" <[email protected]> wrote in message
              >>news:[email protected]...
              >>
              >>>I'm starting a transaction in main thread and this thread spawns three
              >>
              >>threads.
              >>
              >>>I want updates done in main transaction and updates done in three child
              >>
              >>threads
              >>
              >>>to be part of the same transaction. The transaction is finally commited
              >>
              >>by
              >>main
              >>
              >>>thread.
              >>>
              >>>
              >>>
              >>>
              >>>
              >>>"Dimitri I. Rakitine" <[email protected]> wrote:
              >>>
              >>>>What are you trying to do ?
              >>>>
              >>>>Karambir Singh <[email protected]> wrote:
              >>>>
              >>>>
              >>>>>Is there any workaround to do this?
              >>>>
              >>>>>"Dimitri I. Rakitine" <[email protected]> wrote:
              >>>>>
              >>>>>>No, it is associated with a thread which started it.
              >>>>>>
              >>>>>>Karambir Singh <[email protected]> wrote:
              >>>>>>
              >>>>>>
              >>>>>>>Is it possible that same transaction is being used by multiple
              >>
              >>threads
              >>
              >>>>>>concurrently
              >>>>>>
              >>>>>>>in WLS? If each thread is doing suspend and resume how does it
              >>
              >>work?
              >>
              >>>>>>Does the
              >>>>>>
              >>>>>>>transaction implementation support it? Is there a way to do it?
              >>>>>>
              >>>>>>--
              >>>>>>Dimitri
              >>>>>>
              >>>>
              >>>>--
              >>>>Dimitri
              >>>>
              >>>
              >>
              >
              

Maybe you are looking for

  • AP Trial Balance shows invoices already paid

    Hello Experts! I need your help on this please... There are invoices which were already paid in full that appears in our AP Trial Balance and the amount shown is equal to the invoice's withholding tax line. Example: Invoice Workbench--- Invoice Numbe

  • How to configure the integration BPEL x JMS on oracle aplication server

    follwing the error <remoteFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="code"><code>null</code> </part><part name="summary"><summary>file:/u05/bpel/bpel/domains/default/tmp/.bpel_BPELxxBEA_1.0_fce047d117b03b6f174defa6316f81cd.tmp

  • Rebate accrual up to certain quantiy

    Hi, We have an requirement where in rebate needs to be accrued only for certain quanity. For Eg:- Material A, Quantity is 1600 PCs, so rebate should accrue for all customers for specific materail  only for 1600 pcs . Once system reaches 1600 pcs accr

  • Bug in Netbean ?

    I'm using netbeans 6.2 and java 1.6 when I write this line int x=09;the compiler give me error integer number too large: 09 so what is that ?? bug or what ??

  • Nokia 301 set the alarm tone

    Hi, is there a way to set different clock alarm tone? (I didn't manage to find it in the user guide) Thank you Solved! Go to Solution.