Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
135 views

TypeError: Expected a Runnable, callable or dict.Instead got an unsupported type: <class 'list'>

I am experimenting with LLM development. Here is my code: import langchain, pydantic, transformers from langchain import HuggingFacePipeline from langchain_core.prompts import PromptTemplate from ...
Toly's user avatar
  • 3,159
0 votes
0 answers
12 views

i use notification ongoing for vpn download and transmit data in runnable but when i repoen the app and it initialized again and showing twice data

i use notification ongoing for vpn download and transmit data in runnable but when i repoen the app and it initialized again and showing twice data. so i want to closed the stop the prevoius and it is ...
salman khan's user avatar
0 votes
1 answer
102 views

Struggling to inject my mocked Runnable into my service call

For context, I'm using Resilience4j to handle exceptions and invoke retries. This is done through RetryService. In this function, callRunnableWithRetry() there are two params. 1st is a string, the 2nd ...
frlzjosh's user avatar
  • 459
0 votes
0 answers
33 views

Thread refreshing ListView

Its my first program in java. Im writing simple application on Tablet. Application connect to SQL server in my laptop and get some data. At this moment i get data from SQL when i push button. public ...
Rafal S's user avatar
1 vote
1 answer
23 views

How to run several translate animations sequentially with ObjectAnimator?

How to run several translate animations sequentially with ObjectAnimator? I have to animate an image like this -> from the center it moves to the left and then returns to the center, after which it ...
DevMD's user avatar
  • 29
3 votes
1 answer
38 views

Android Handler: how to change delay of a scheduled Runnable?

The following code schedules a Runnable for immediate execution if this Runnable is already scheduled: public void onSomeEvent() { if (handler.hasCallbacks(runnable)) { handler....
A.G.'s user avatar
  • 2,119
0 votes
0 answers
17 views

Android studio Smooth inflate

I have my own application that I programmed using java in Android studio The application connects to my server and the server returns json data The application takes this information, transforms it, ...
تجربي تجريبي's user avatar
-1 votes
1 answer
82 views

Make a `Callable` of my `Runnable` in Java

I have some tasks defined as Runnable objects. I want to invoke those tasks by using the invokeAll or invokeAny methods on ExecutorService. The problem is that those methods take a collection of ...
Basil Bourque's user avatar
0 votes
0 answers
13 views

Runnable jar file "A Java exception has occurred" [duplicate]

I recently got back into Java. Just installed Eclipse 2024-03 as well as 1.8.0_411. Coded a simple program that just opens a 500x500 pixels JFrame and closes when that frame is closed. Using JRE 17. ...
VACN's user avatar
  • 75
3 votes
0 answers
438 views

The chat history is being recorded twice, using both RunnableWithMessageHistory and RunnableLambda from LangChain

As shown in the following code, I want to create a branch in RunnableLambda, and at the destination of the branch, I want to use RunnableWithMessageHistory to generate a response considering the chat ...
Keita Kiuchi's user avatar
1 vote
0 answers
126 views

Method 'main()' does not have signature 'public static void main(String[])'. The program cannot be started while main has this problem

When trying to complete a task ("Create a Dog class containing two String type fields: name and says. In the method main() create two Dog objects with different names (spot and scruffy) and ...
Nik's user avatar
  • 11
0 votes
1 answer
29 views

How to "kill" current runnable and start a new one pressing a start/stop android button (and prevent multiple overlapping runnable processes)?

I am struggling with an android button to start/stop a recurrent function, but I couldn't find a suitable solution/explanation after trying to use the handler.postDelayed(), handler....
Paul Smith's user avatar
2 votes
0 answers
136 views

Remove/exclude default response from langserve chain response while invoke method curl or postman with Pydantic Output Parser

In Langserve API, created below route eg: http://localhost:8000/get_gpt4/invoke app = FastAPI(title=" API", version="1.0", description="Helper APIs to augment language ...
Mac's user avatar
  • 29
0 votes
1 answer
72 views

Overlapping JLabels in Tetris

So I'm trying to code Tetris in Java and I'm using JLabels for each piece. I'm using a Runnable timer to have the pieces move down, and then I use if statements with an executor to control when the ...
MildArachnophobe's user avatar
0 votes
0 answers
47 views

Mockito: test method with new Runnable() thread

I have the method: @Override public void saveCompetence(/*...*/) throws Exception { try { operationSupport.mode1(new Runnable() { @Override public void run() { ...
alex_t's user avatar
  • 91
0 votes
0 answers
36 views

pytz failed to import in background runnable script in Windmill

I coded my inline script and successfully imported pytz module, but when i type the same line import pytz it failed, error said: ModuleNotFoundError: No module named 'pytz' i try both #...
daleng's user avatar
  • 19
0 votes
0 answers
59 views

My game is losing focus when I click on the Canvas

So, it works perfectly fine when I open it, but when I click on it (on the game, not on the window, I can even move the window and it still working) it just stops working And, if I do it while the ...
Gabriel's user avatar
0 votes
0 answers
22 views

BukkitScheduler doesn't repeat the task correctly

I am trying to do a grenade launcher, and I want to be able to code an animation of the grenade when the player launches it with a right click (= I want the player to be able to see the grenade before ...
Manewow's user avatar
-1 votes
2 answers
87 views

How to pass a callable object as runnable object? Can we type cast Callable to Runnable?

How is the below structure possibly working? Please explain. Thanks in advance. public abstract class AbstractCallableClass { protected abstract V getCallable(); public void passRunnable() { ...
Utkarsh's user avatar
1 vote
1 answer
1k views

What is the difference between chains and runnables in langchain?

I am new to langchain and langserve. the langserve definition goes as "LangServe helps developers deploy LangChain runnables and chains as a REST API." But could not understand the basic ...
bhoomika's user avatar
1 vote
1 answer
58 views

Make a ScheduledExecutorService single Thread create other independent and non-blocking Threads

I'm facing a problem with what the title suggests. I have a @Component that monitors "Processes". Once the first Process is registered in the component, I initialize my ...
deko's user avatar
  • 495
0 votes
0 answers
56 views

Java Runnable Interface and Threadpool: EntityManager transactions that are run by multiple threads don't seem to close

I am trying to build a scheduler service using java.util.concurrent.ScheduledExecutorService. This will call a custom class that implements the Runnable interface, and the Runnable interface will ...
swing1234's user avatar
  • 233
0 votes
0 answers
41 views

How to keep the seek bar persistent even after back button is pressed and re opened player activity

i am trying to create a music app. the seek bar in the media player is not working if i pressed back button and reopen the activity again. could anybody help me to solve this problem? here is My play ...
coppersmith's user avatar
0 votes
1 answer
372 views

Can I implement Shedlock for the run method implemented by the runnable interface

I have a scheduler task created using Scheduled Future and Task scheduler. the scheduled task is basically a new class which implements runnable and used run method of the runnable interface. My doubt ...
Flammy's user avatar
  • 11
1 vote
0 answers
26 views

NullPointerException on View Pager getCurrentItem

I am using viewpager for a carousel in my application. it works fine when the app open for the first time, but when coming back from another fragment am getting an error as NullPointerException, I ...
Anees Ani's user avatar
-2 votes
1 answer
102 views

Can we have a long process in a thread updates a progress bar? [closed]

I’m facing a problem with thread and interface. In my example I have a long process. Along calculations I must stop and ask the user informations. I cannot do that before. So I have to open a window ...
4E71-NOP's user avatar
-1 votes
1 answer
75 views

Create Runnable with "final" variable from the parent?

Create multiple new Runnable inside a loop ? I want to create multiple new instances of Runnable that calls another method and passing the "i" parameter from the parent's loop. I do not want ...
Juraon's user avatar
  • 11
0 votes
2 answers
1k views

Java - Execute multiple Runnables in parallel and trigger to timeout some of long running tasks?

I've a list of Runnable tasks (e.g. it contains 100 tasks, and each task takes randomly 1 - 10 seconds). The tasks must run in parallel and from the thread pool provided by ExecutorService (e.g. my ...
Bằng Rikimaru's user avatar
0 votes
1 answer
26 views

Runnable should start only one time

how can I prevent the runnable from being started a second time when the app is restarted? The runnable sends messages out at a certain interval. I've been working with SharedPrefrences and it doesn'...
Mand's user avatar
  • 1
0 votes
1 answer
155 views

How to show a circular loader during an API request in Android Studio

I am trying to show the Progress Bar component (circular, not horizontal) during a GET api request in Android Studio. I am running the API request on a different thread and I am setting the progress ...
CladCobra's user avatar
1 vote
2 answers
88 views

Can i encapsulate the creation of similar threads into a method?

I'm writing a search function that is doing multiple API calls that i would like to execute asynchronous and collect their results. All my threads with their runnables look similar which made we ...
Patrick's user avatar
  • 43
-1 votes
1 answer
411 views

Is "public static void main(String[] name)" the only way to make a runnable class?

The only clear commands of the main class for me are static, because you have to execute the method wihtout needing an object, void, because it has no return value and the String array name which you ...
Connor's user avatar
  • 1
0 votes
1 answer
56 views

How do I use the synchronized command correctly?

I'm making a game to memorise katakana. It plays like Whack-a-mole, and I have nine buttons that flash to show either true or false answers. I have two textViews. One displays romaji and the other ...
Binbows's user avatar
  • 35
-1 votes
3 answers
658 views

how to prevent Out Of Memory because of many Runnables [closed]

I need to run 100 tasks. I want to run them in parallel, but only 10 simultaneously. I can use for it simple ExecutorService service = Executors.newFixedThreadPool(10); then create 10 Runnables and ...
nik's user avatar
  • 379
0 votes
2 answers
80 views

Why Synchronization not working properly with while extending to Thread?

Currently, I'm studying "synchronization", while I was doing an exercise on the synchronization method I couldn't able to get a proper output but when I'm trying the same exercise by ...
aMn's user avatar
  • 3
0 votes
1 answer
92 views

How can I convert an AsyncTask to a Runnable?

I want to set bitmap for ImageView. I have the URL from Firebase stroage, I use the BitmapFactory to turn to picture, I need to apply it on ImageView, I can do it with AsyncTask but I don't know how ...
Jeff Li's user avatar
  • 31
0 votes
1 answer
58 views

Get width of two elements after the drawing phase at the same time

I have seen in the following answer: https://stackoverflow.com/a/24035591 of another post that to get the width of an element after the drawing phase I can do the following: @Override protected void ...
sacacorchos's user avatar
1 vote
1 answer
107 views

Best approach to manage parallel threads with a set of ip addresses using ExecutorService

I have a set of 255 ip addresses to manage (x.x.x.1 -> x.x.x.255). In Java if I check connection from my java mobile app with only one array of IP with a setTimeout(200) I could wait too much till ...
Luigino's user avatar
  • 791
0 votes
0 answers
43 views

Collections.sort with comparator inside runnable return duplicated items?

i am trying to sort a list of contacts(android/car/telephony/common/Contact.java) that does not contain duplicated items: private void updateSortedContactList() { if (mContactListLiveData....
Miled's user avatar
  • 119
0 votes
1 answer
202 views

Should I use Thread and .join or Callable along with Future and .get?

I am writing a simple thread that simply run a process and reads the InputStream. While reading the input, if it finds a certain string it sets a boolean to true. Then when I need to check that ...
zaxunobi's user avatar
  • 890
0 votes
0 answers
81 views

How do I kill a blocking thread? (Cannot check for interruption)

I have a thread that is running a runnable with just one command, that will block forever: mainRunnable = new Runnable(){ public void run(){ startClient(); } }; This is not a normal ...
Markusbug's user avatar
0 votes
0 answers
38 views

android timer loop in a thread to be accessible multiple activities

I’m working on a small project that sends and receives data via Bluetooth between an Android Tablet and an Arduino board. My application has two separate Activities (Configure and Operate) that needs ...
Gerald Eberhardt's user avatar
0 votes
1 answer
160 views

How to refresh a recyclerview adapter to show the pool thread progress

I have a list of process into a pool of threads, I show the progress of the process in every item of the recycler view, and I need to refresh the adapter in order to show the new process processing in ...
Joel Forero's user avatar
0 votes
1 answer
286 views

How to run a map of runnables in order

I'm trying to make a method that runs a series of steps defined by lambdas. Each of those steps can be anything, they will be defined in different parts of the code, but they share some logic that has ...
Agustín's user avatar
0 votes
1 answer
134 views

How to set negative translationX before app load

when I set a view's translationX whether via XML or programmatically android seems to ignore the code. When I run view.setTranslationX(-200); it ignores the translation and the app shows the view at ...
Bret Joseph's user avatar
0 votes
1 answer
732 views

Tasks Queue for Android - Kotlin

I want to add Tasks (or Runnable) in queue that I want to execute in series. New task comes in at run time, depending on conditions. I also want to add a delay after each task before it starts the ...
M. Usman Khan's user avatar
2 votes
2 answers
67 views

I want to stop a group of completed threads, wait for uncompleted threads

I need a group of threads to run at the same time, and then another group of threads after that. For example, 10 threads start working, and then 10 or 15 other threads. Of course, the first approach I'...
HamidReza Jahandideh's user avatar
0 votes
1 answer
752 views

Logging tasks that were being processed by ExecutorService when it was shut down

I'm working on a Spring Boot application that accepts requests and processes them using an ExecutorService. Each task submitted to the ExecutorService is non-iterative, long-running and is non-...
John Allison's user avatar
0 votes
1 answer
57 views

How to use existing Objects in an overwritten run() Method?

I'm a beginner in programming and do strugle a bit. So I'm building a TCP peer to peer Chat and that requires me to divide the tasks -> Threads. So I want to built a Thread for the "writing&...
Ljonja2107's user avatar
0 votes
1 answer
674 views

Null Pointer Exception when Calling repository in a class implementing Runnable

I have a project in which there is a use case where a user books a meeting lets suppose for 10am to 11 am with another user. Now on the backend i want to check at 11 am if the meeting went well or not....
shubham sharma's user avatar

1
2 3 4 5
42