开发者

LinkedBlockQueue can't pass Watchable [closed]

开发者 https://www.devze.com 2023-03-04 23:33 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help cla开
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help cla开发者_Go百科rifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I want to ask you something i'm doing like that ..

LinkedBlockingQueue<Whatch_Directory> queue 
    = new LinkedBlockingQueue<classes.Watchable.Whatch_Directory>(); 
queue.put(classes.Watchable.Whatch_Directory.create_watchable("dir"));

but everything down from the classes.Watchable etc this is the function with the watchable class everything down him isn't showing, still only the watchable is running.


If I understand what you're asking, you're creating a Whatch_Directory class somewhere else, trying to make a LinkedBlockingQueue of such things and using a factory method create_watchable() to create one.

If so, it appears that a Whatch_Directory is extending the Watchable interface (based on your other questions). It seems that your code should become something more like:

class Whatch_Directory implements Watchable {
    public static Watchable create_watchable(String s) {
        // Your definition goes here
    }
}

LinkedBlockingQueue<Whatch_Directory> queue = 
    new LinkedBlockingQueue<Whatch_Directory>();
queue.put(Whatch_Directory.create_watchable("dir");

Some more explanation of your intent would be helpful but here are some things that I suggest you check based on my understanding:

  1. Make sure that create_watchable() returns the correct type. It needs to be returning something of type Whatch_Directory based on your code.

  2. Make sure that create_watchable() isn't returning null for some reason.

  3. Make sure that create_watchable() isn't throwing an exception.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号