Search Results

Search found 8588 results on 344 pages for 'thread abort'.

Page 97/344 | < Previous Page | 93 94 95 96 97 98 99 100 101 102 103 104  | Next Page >

  • Cocoa Touch - Display an Activity Indicator while loading a UITabBar View

    - by Aurum Aquila
    I have a UITabBar Application with two views that load large amounts of data from the web in their "viewWillAppear" methods. I want to show a progress bar or an activity indicator while this data is being retrieved, to make sure the user knows the app isn't frozen. I am aware that this has been asked before. I simply need some clarification on what seems to be a rather good solution. I have implimented the code in the example. The question's original asker later solved their problem, by putting the retrieval of data into another "thread". I understand the concept of threads, but I do not know how I would impliment this. With research, I have found that I need to move all of my heavy data retrieval into a background thread, as all of the UI updating occurs in the main thread. If one would be so kind as to provide an example for me, I would be very appreciative. I can provide parts of my existing code as necessary.

    Read the article

  • Showing a Toast using "setUncaughtExceptionHandler"

    - by VitalyB
    Hi everyone, I'm trying to do a simple global exception handler in my Android app and I am having troubles: public class TicTacToe extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Thread.currentThread().setUncaughtExceptionHandler(new UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable ex) { Toast.makeText(this, "TOAST", Toast.LENGTH_LONG); } }); setContentView(R.layout.main); } } I'm a rather new with both Android AND java but in .NET that would work. Can't I access local variable from anonymous methods in java? If so, how should I rewrite it? Thanks, Vitaly

    Read the article

  • The Tab1.java from API Demo has exception.

    - by Kooper
    I don't know why.All my Tab programs have exception.Even from API Demo. Here is the code: package com.example.android.apis.view; import android.app.TabActivity; import android.os.Bundle; import android.widget.TabHost; import android.widget.TabHost.TabSpec; import android.view.LayoutInflater; import android.view.View; public class Tab1 extends TabActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TabHost tabHost = getTabHost(); LayoutInflater.from(this).inflate(R.layout.main,tabHost.getTabContentView(), true); tabHost.addTab(tabHost.newTabSpec("tab1") .setIndicator("tab1") .setContent(R.id.view1)); tabHost.addTab(tabHost.newTabSpec("tab2") .setIndicator("tab2") .setContent(R.id.view2)); tabHost.addTab(tabHost.newTabSpec("tab3") .setIndicator("tab3") .setContent(R.id.view3)); } } Here is the log: 06-13 17:24:38.336: WARN/jdwp(262): Debugger is telling the VM to exit with code=1 06-13 17:24:38.336: INFO/dalvikvm(262): GC lifetime allocation: 2511 bytes 06-13 17:24:38.416: DEBUG/Zygote(30): Process 262 exited cleanly (1) 06-13 17:24:38.456: INFO/ActivityManager(54): Process com.example.android.apis.view (pid 262) has died. 06-13 17:24:38.696: INFO/UsageStats(54): Unexpected resume of com.android.launcher while already resumed in com.example.android.apis.view 06-13 17:24:38.736: WARN/InputManagerService(54): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44dc4b38 06-13 17:24:48.337: DEBUG/AndroidRuntime(269): AndroidRuntime START <<<<<<<<<<<<<< 06-13 17:24:48.346: DEBUG/AndroidRuntime(269): CheckJNI is ON 06-13 17:24:48.856: DEBUG/AndroidRuntime(269): --- registering native functions --- 06-13 17:24:49.596: DEBUG/ddm-heap(269): Got feature list request 06-13 17:24:50.576: DEBUG/AndroidRuntime(269): Shutting down VM 06-13 17:24:50.576: DEBUG/dalvikvm(269): DestroyJavaVM waiting for non-daemon threads to exit 06-13 17:24:50.576: DEBUG/dalvikvm(269): DestroyJavaVM shutting VM down 06-13 17:24:50.576: DEBUG/dalvikvm(269): HeapWorker thread shutting down 06-13 17:24:50.586: DEBUG/dalvikvm(269): HeapWorker thread has shut down 06-13 17:24:50.586: DEBUG/jdwp(269): JDWP shutting down net... 06-13 17:24:50.586: INFO/dalvikvm(269): Debugger has detached; object registry had 1 entries 06-13 17:24:50.596: ERROR/AndroidRuntime(269): ERROR: thread attach failed 06-13 17:24:50.606: DEBUG/dalvikvm(269): VM cleaning up 06-13 17:24:50.676: DEBUG/dalvikvm(269): LinearAlloc 0x0 used 628628 of 5242880 (11%) 06-13 17:24:51.476: DEBUG/AndroidRuntime(278): AndroidRuntime START <<<<<<<<<<<<<< 06-13 17:24:51.486: DEBUG/AndroidRuntime(278): CheckJNI is ON 06-13 17:24:51.986: DEBUG/AndroidRuntime(278): --- registering native functions --- 06-13 17:24:52.746: DEBUG/ddm-heap(278): Got feature list request 06-13 17:24:53.716: DEBUG/ActivityManager(54): Uninstalling process com.example.android.apis.view 06-13 17:24:53.726: INFO/ActivityManager(54): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.android.apis.view/.Tab1 } 06-13 17:24:53.876: DEBUG/AndroidRuntime(278): Shutting down VM 06-13 17:24:53.886: DEBUG/dalvikvm(278): DestroyJavaVM waiting for non-daemon threads to exit 06-13 17:24:53.916: DEBUG/dalvikvm(278): DestroyJavaVM shutting VM down 06-13 17:24:53.926: DEBUG/dalvikvm(278): HeapWorker thread shutting down 06-13 17:24:53.936: DEBUG/dalvikvm(278): HeapWorker thread has shut down 06-13 17:24:53.936: DEBUG/jdwp(278): JDWP shutting down net... 06-13 17:24:53.936: INFO/dalvikvm(278): Debugger has detached; object registry had 1 entries 06-13 17:24:53.957: DEBUG/dalvikvm(278): VM cleaning up 06-13 17:24:54.026: ERROR/AndroidRuntime(278): ERROR: thread attach failed 06-13 17:24:54.146: DEBUG/dalvikvm(278): LinearAlloc 0x0 used 638596 of 5242880 (12%) 06-13 17:24:54.286: INFO/ActivityManager(54): Start proc com.example.android.apis.view for activity com.example.android.apis.view/.Tab1: pid=285 uid=10054 gids={1015} 06-13 17:24:54.676: DEBUG/ddm-heap(285): Got feature list request 06-13 17:24:55.006: WARN/ActivityThread(285): Application com.example.android.apis.view is waiting for the debugger on port 8100... 06-13 17:24:55.126: INFO/System.out(285): Sending WAIT chunk 06-13 17:24:55.186: INFO/dalvikvm(285): Debugger is active 06-13 17:24:55.378: INFO/System.out(285): Debugger has connected 06-13 17:24:55.386: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:55.586: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:55.796: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:55.996: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:56.196: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:56.406: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:56.606: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:56.806: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:57.016: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:57.216: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:57.416: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:57.626: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:57.836: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:58.039: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:58.246: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:58.451: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:58.656: INFO/System.out(285): waiting for debugger to settle... 06-13 17:24:58.866: INFO/System.out(285): debugger has settled (1367) 06-13 17:24:59.126: ERROR/gralloc(54): [unregister] handle 0x129980 still locked (state=40000001) 06-13 17:25:03.816: WARN/ActivityManager(54): Launch timeout has expired, giving up wake lock! 06-13 17:25:04.906: WARN/ActivityManager(54): Activity idle timeout for HistoryRecord{44d60e10 com.example.android.apis.view/.Tab1}

    Read the article

  • How to write async background workers that work on WPF flowdocument

    - by iBe
    I'm trying to write a background worker that processes a flowdocument. I can't access the properties of flowdocument objects because of the thread verification. I tried to serialize the document and loaded it on the worker thread which actually solved the thread verfication issue. However, once the processing is complete I also need to use things like TextPointer objects. Those objects now point to a objects in the copy not the original. Can anyone suggest the best way to approach such background processing in WPF?

    Read the article

  • java - volatile keyword

    - by Tiyoal
    Say I have two threads and an object. One thread assigns the object: public void assign(MyObject o) { myObject = o; } Another thread uses the object: public void use() { myObject.use(); } Does the variable myObject have to be declared as volatile? I am trying to understand when to use volatile and when not, and this is puzzling me. Is it possible that the second thread keeps a reference to an old object in its local memory cache? If not, why not? Thanks a lot.

    Read the article

  • CAsyncSocket and ThreadPool problem

    - by zabulus
    I have a server application with such structure: There is one object, call him Server, that in endless cycle listens and accepts connections. I have descendant class from CAsyncSocket, that has overriden event OnReceive, call him ProxySocket. Also I have a thread pool with early created threads. When connection is received by server object he accepts the new connection on the new object ProxySocket. When data arrives to the ProxySocket, he creates a command object and gives it to thread pool. In this command object I giving the socket handle of a ProxySocket. When new object of command is creating - I creating a new Socket in working thread and attach handle to it. My issue is next: When command ends, socket doesn't close, I just detach handle it and set CSocket handle to INVALID_SOCKET value, as planned. But my first ProxySocket object doesn't receives messages of new data receiving after that. How can I solve this?

    Read the article

  • Why am I getting a segmentation fault when I use binmode with threads in Perl?

    - by jAndy
    Hi Folks, this call my $th = threads->create(\&print, "Hello thread World!\n"); $th->join(); works fine. But as soon as I add binmode(STDOUT, ":encoding(ISO-8859-1)"); to my script file, I get an error like "segmentation fault", "access denied". What is wrong to define an encoding type when trying to call a perl thread? Example: use strict; use warnings; use threads; binmode(STDOUT, ":encoding(ISO-8859-1)"); my $th = threads->create(\&print, "Hello thread World!\n"); $th->join(); sub print { print @_; } This code does not work for me. Kind Regards --Andy

    Read the article

  • Why can i read dirty rows in MySql

    - by acidzombie24
    I cant believe this, i always throught the below would be concurrency safe. I write to a row in one transaction and i am able to read the dirty value from another transaction/command/connection! Why is this possible (not my main question) isnt this not desired and cause more troubles!?! Anyways, i expected that once i write to a row nothing else will be able to read to the row until the transaction is finished. And at least if the row can be still read that the clean (original) value will be read. (but maybe that would cause problems as well if the transaction doesnt use the newly commited data from the other transaction when it is ran) I would like count to == 11. I thought this would be safe in all variants of sql. What can i do to either 1) Not read the dirty value but clean 2) Have that row be locked until the transaction is finished? static MySqlConnection MakeConn() { string connStr = "server=192.168.126.128;user=root;database=TestDB;port=3306;password=a;"; MySqlConnection conn = new MySqlConnection(connStr); conn.Open(); return conn; } static Semaphore sem1 = new Semaphore(1, 1); static Semaphore sem2 = new Semaphore(1, 1); static void Main2() { Console.WriteLine("Starting Test"); // sem1.WaitOne(); Console.WriteLine("1W"); sem2.WaitOne(); Console.WriteLine("2W"); Thread oThread = new Thread(new ThreadStart(fn2)); oThread.Start(); var conn = MakeConn(); var cmd = new MySqlCommand(@" CREATE TABLE IF NOT EXISTS Persons ( P_Id int NOT NULL, name varchar(255), count int, PRIMARY KEY (P_Id) )", conn); cmd.ExecuteNonQuery(); cmd.CommandText = "delete from Persons; insert into Persons(name, count) VALUES('E', '4');"; cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; var count = (int)cmd.ExecuteScalar(); Console.WriteLine("Finish inserting. v={0}", count); sem2.Release(); Console.WriteLine("2R"); sem1.WaitOne(); Console.WriteLine("1W"); Console.WriteLine("Starting transaction"); using (var tns = conn.BeginTransaction()) { cmd.CommandText = "update Persons set count=count+1"; cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); sem2.Release(); Console.WriteLine("2R"); sem1.WaitOne(); Console.WriteLine("1W"); count += 5; //10 cmd.CommandText = "update Persons set count=" + count.ToString(); cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); tns.Commit(); } Console.WriteLine("finished transaction 1"); sem2.Release(); Console.WriteLine("2R"); sem1.WaitOne(); Console.WriteLine("1W"); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); sem2.Release(); Console.WriteLine("2R"); //sem1.WaitOne(); Console.WriteLine("1W"); } static void fn2() { int count; Console.WriteLine("Starting thread 2"); sem2.WaitOne(); Console.WriteLine("1W"); var conn = MakeConn(); var cmd = new MySqlCommand("", conn); sem1.Release(); Console.WriteLine("1R"); sem2.WaitOne(); Console.WriteLine("2W"); using (var tns = conn.BeginTransaction()) { cmd.CommandText = "update Persons set count=count+1"; cmd.ExecuteNonQuery(); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); sem1.Release(); Console.WriteLine("1R"); sem2.WaitOne(); Console.WriteLine("2W"); tns.Commit(); } Console.WriteLine("finished transaction 2"); sem1.Release(); Console.WriteLine("1R"); sem2.WaitOne(); Console.WriteLine("2W"); cmd.CommandText = "select count from Persons;"; count = (int)cmd.ExecuteScalar(); Console.WriteLine("count is {0}", count); //should be 11. 4 + 1x2(one each thread) += 5 from first thread == 11 sem1.Release(); Console.WriteLine("1R"); } console Starting Test 1W 2W Starting thread 2 Finish inserting. v=4 2R 1W 1R 1W Starting transaction count is 5 2R 2W count is 6 1R 1W count is 10 finished transaction 1 2R 2W finished transaction 2 1R 1W count is 10 2R 2W count is 10 1R

    Read the article

  • Throughput measurements

    - by dotsid
    I wrote simple load testing tool for testing performance of Java modules. One problem I faced is algorithm of throughput measurements. Tests are executed in several thread (client configure how much times test should be repeated), and execution time is logged. So, when tests are finished we have following history: 4 test executions 2 threads 36ms overall time - idle * test execution 5ms 9ms 4ms 13ms T1 |-*****-*********-****-*************-| 3ms 6ms 7ms 11ms T2 |-***-******-*******-***********-----| <-----------------36ms---------------> For the moment I calculate throughput (per second) in a following way: 1000 / overallTime * threadCount. But there is problem. What if one thread will complete it's own tests more quickly (for whatever reason): 3ms 3ms 3ms 3ms T1 |-***-***-***-***----------------| 3ms 6ms 7ms 11ms T2 |-***-******-*******-***********-| <--------------32ms--------------> In this case actual throughput is much better because of measured throughput is bounded by the most slow thread. So, my question is how should I measure throughput of code execution in multithreaded environment.

    Read the article

  • JavaFX Threading issue - GUI freezing while method call ran.

    - by David Meadows
    Hi everyone, I hoped someone might be able to help as I'm a little stumped. I have a javafx class which runs a user interface, which includes a button to read some text out loud. When you press it, it invokes a Java object which uses the FreeTTS java speech synth to read out loud a String, which all works fine. The problem is, when the speech is being read out, the program stops completely until its completed. I'm not an expert on threaded applications, but I understand that usually if I extend the Thread class, and provided my implementation of the speech synth code inside an overridden run method, when I call start on the class it "should" create a new Thread, and run this code there, allowing the main thread which has the JavaFX GUI on to continue as normal. Any idea why this isn't the case? Thanks a lot in advance!

    Read the article

  • Put an object in Handler message

    - by Tsimmi
    Hi! I need to download an image from the internet, in a different thread, and then send that image object in the handler message, to the UI thread. I already have this: ... Message msg = Message.obtain(); Bundle b = new Bundle(); b.putParcelable("MyObject", (Parcelable) object); msg.setData(b); handler.sendMessage(msg); And when I receive this message, I want to extract the object: ... public void handleMessage(Message msg) { super.handleMessage(msg); MyObject objectRcvd = (MyObject) msg.getData().getParcelable("IpTile"); addToCache(ipTile); mapView.invalidate(); } But this is giving me: ...java.lang.ClassCastException... Can anyone help? And by the way, is this the most efficient way to pass an object to the UI Thread? Thank you all!

    Read the article

  • How to check whether the form has any ShowDialog() forms open?

    - by kornelijepetak
    I have a form MainForm with several properties/methods that are accessed from another thread. At some point I might open a form AuxForm with ShowDialog() and then while that modal form is open, the other thread still modifies the MainForm's properties. This is all desired. In one of the methods accessed from another thread I need to execute some code, but only if the modal AuxForm is not open. Is there any way to check this (by using .NET WF Form properties) or I need to use a flag variable? NOTE: None of these properties/methods modify the controls (so no Invoke is required).

    Read the article

  • CollectionChanged notification across threads?

    - by Mark
    I'm writing a download manager using C#/WPF, and I just encountered this error: This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread. The basic flow of my program is that a few web pages/downloads are enqueued at the start, and then they're downloaded asynchronously. When an HTML page has completed downloading, I parse it and look for more stuff to download, then enqueue it directly from within the worker thread. I get that error when trying to send out the CollectionChanged event on my customized queue class. However, I need to fire that event so that the GUI can get updated. What are my options?

    Read the article

  • How to control a subthread process in python?

    - by SpawnCxy
    Code first: '''this is main structure of my program''' from twisted.web import http from twisted.protocols import basic import threading threadstop = False #thread trigger,to be done class MyThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.start() def run(self): while True: if threadstop: return dosomething() '''def some function''' if __name__ == '__main__': from twisted.internet import reactor t = MyThread() reactor.listenTCP(serverport,myHttpFactory()) reactor.run() As my first multithread program,I feel happy that it works as expected.But now I find I cannot control it.If I run it on front,Control+C can only stop the main process,and I can still find it in processlist;if I run it in background,I have to use kill -9 pid to stop it.And I wonder if there's a way to control the subthread process by a trigger variale,or a better way to stop the whole process other than kill -9.Thanks.

    Read the article

  • Multithread Communication

    - by Robert
    I'm creating a WPF application that uses a custom object to populate all the controls. The constructor of that object is initiated by an EventHandler that waits for an API. The problem I'm having is when I try to access any information from that object using a button for example, it returns an error saying "The calling thread cannot access this object because a different thread owns it". I'm assuming this is because the EventHandler creates a new thread which doesn't allow the MainThread to have access to it. Any ideas on how to get around this?

    Read the article

  • Strophe javascript prevent disconnection on some delay

    - by patrikas
    Hello, I am developing javascript XMPP application which uses Strophe library to connect to Jabber server. I need to engage the thread for about 5-10 seconds when Strophe connects to the server. Thread is engaged by running java applet and after it releases the thread it goes back to handle XMPP events, however at the moment I cannot manage to do that - trying to use a connection after delay gives me 404 HTTP error (this is sent by XMPP-BOSHS service straight after Strophe sends POST request with XMPP message to it). I was trying to 'pause' a connection with Strophe's connection.pause and then resume it - didn't work. Would sending some raw content to the server, maybe if it's possible telling it that client's gonna be unresponsive for a short time work ? Are there any other solutions ? Thanks

    Read the article

  • Keep a reference to an NSThread around and message its objects?

    - by RickiG
    Hi I am a bit uncertain on how to do this: I start a "worker-thread" that runs for the duration of my apps "life". [NSThread detachNewThreadSelector:@selector(updateModel) toTarget:self withObject:nil]; then - (void) updateModel { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; BackgroundUpdate *update = [[BackgroundUpdate alloc] initWithTimerInterval:5]; [[NSRunLoop currentRunLoop] run]; //keeps it going 'forever' [update release]; [pool release]; } Now the thread "wakes" up every 5 seconds(initWithTimerInterval) to see if there are any tasks it can do. All the tasks in the BackGroundUpdate Class are only time dependent for now. I would like to have a few that were "event dependent". e.g. I would like to call the Background Object from my main thread and tell it to "speedUp", "slowDown", "reset" or any method on the object. To do this I guess I need something like performSelectorOnThread but how to get a reference to the NSthread and the Background Object?

    Read the article

  • Wait for tasks to get completed in threadpool.

    - by Alien01
    Hello I have created a thread pool in C++ which stores all tasks in a queue. Thread pool start n number of threads which takes tasks from queue , process each task and then delete tasks from queue. Now , I want to wait till all tasks get completed. Checking for empty queue for completion of tasks may not work as , task can be given to each thread and queue can be emptied but still the tasks can in processing mode. I am not getting idea how to wait for all the tasks completion.This is a design problem. Any suggestions?

    Read the article

  • hibernate not throwing stale state exception nor it is overwriting data

    - by Reddy
    Our application do the following. 1. Start the transaction. 2. Execute a query using prepared statement 3. Check a condition to see the number of rows updated are equal to the required number. 4. It commits on success of above condition otherwise it will roll back However the problem is that when two threads are simultaneously enter this code. Thread-1 is updating a row in step 2. It checked the condition and committed successfully since the condition is successful. Thread-2 started execution somewhere between steps 1 & 4, and it is failing on at condition checking at step 3 (as it is getting number of updated rows as 0). I expected second thread to throw an exception but it is not. What could be the problem?

    Read the article

  • How to save objects using Multi-Threading in Core Data?

    - by Konstantin
    I'm getting some data from the web service and saving it in the core data. This workflow looks like this: get xml feed go over every item in that feed, create a new ManagedObject for every feed item download some big binary data for every item and save it into ManagedObject call [managedObjectContext save:] Now, the problem is of course the performance - everything runs on the main thread. I'd like to re-factor as much as possible to another thread, but I'm not sure where I should start. Is it OK to put everything (1-4) to the separate thread?

    Read the article

  • c# multi threaded file processing

    - by user177883
    There is a folder that contains 1000 of small text files. I aim to parse and process all of them while more files are being populated in to the folder. My intention is to multithread this operation as the single threaded prototype took 6 minutes to process 1000 files. I like to have reader and writer thread(s) as following : while the reader thread(s) are reading the files, I d like to have writer thread(s) to process them. Once the reader is started reading a file, I d like to mark it as being processed, such as by renaming it, once it s read, rename it to completed. How to approach such multithreaded application ? Is it better to use a distributed hash table or a queue? Which data structure to use that would avoid locks? Would you have a better approach to this scheme that you like to share?

    Read the article

  • Where will this AsyncTask run?

    - by Binoy Babu
    Say I have this code in the AlertDialog.Builder(context) of my application. The question is in which Thread will it run? final Thread myPrettyOperation = new Thread() { @Override public void run() { //Do some really long operation. } }; class MyPrettyTask extends AsyncTask<Void, Integer, Boolean> { protected Boolean doInBackground( Void... voids) { myPrettyOperation.start(); return true; } protected void onProgressUpdate( Integer... progress) { } protected void onPostExecute(Boolean result) { } } new MyPrettyTask().execute();

    Read the article

  • Windows Service suddenly doing nothing

    - by TB
    Hi, My windows service is using a Thread (not a timer) which is always looping and sleeps for 1 second every loop using : evet.WaitOne(interval); When I start the service it works fine and I can see in the task manager that it is running, consuming and releasing memory, consuming processor ... etc that is all normal, but after a while (random amount of time) the service simply stops!! it is still there in the task manager but it is not consuming any processor work now and its consumption to the memory is not changing. it simply (died but still there in the task manager like a Zombie). I know that many exceptions might have happened during running the service (it is really doing many things) but all those exceptions are handled in Try catch blocks, so why is my "always looping" thread stops ??? This thread also logs every time he loops, when he is freezig in this way he is not logging anything (of course)

    Read the article

  • Other SecurityManager implementations available?

    - by mhaller
    Is there any other implementation (e.g. in an OSS project) of a Java SecurityManager available which has more features than the one in the JDK? I'm looking for features like configurable at runtime policies updateable at runtime, read from other data sources than a security.policy file Thread-aware, e.g. different policies per Thread Higher-level policies, e.g. "Disable network functions, but allow JDBC traffic" Common predefined policies, e.g. "Allow read-access to usual system properties like file.encoding or line.separator, but disallow read-access to user.home" Monitoring and audit trace logging, e.g. "Log all file access, log all network access going NOT to knownhost.example.org" Blocking jobs "requesting" a permission until an administrator grants permission, letting the thread/job continue ... I'm pretty sure that application servers (at least the commercial ones) have their own SecurityManager implementation or at least their own policy configuration. I'm wondering if there is any free project with similar requirements.

    Read the article

  • Efficient synchronization of querying an array of resources

    - by Erel Segal Halevi
    There is a list of N resources, each of them can be queried by at most a single thread at a time. There are serveral threads that need to do the same thing at approximately the same time: query each of the resources (each thread has a different query), in arbitrary order, and collect the responses. If each thread loops over the resources in the same order, from 0 to N-1, then they will probably have to wait for each other, which is not efficient. I thought of letting the threads loop over the resources in a random permutation, but this seems too complex and also not so efficient, for example, for 2 resources and 2 threads, in half the cases they will choose the same order and wait for each other. Is there a simple and more efficient way to solve this?

    Read the article

< Previous Page | 93 94 95 96 97 98 99 100 101 102 103 104  | Next Page >