플렉스 클라이언트와 블레이즈/스프링/자바 백엔드로 구성된 다중 사용자 응용 프로그램이 있습니다. 즉 주요 요소가 정상적으로 작동합니다. 목적지로 메시지를 보내 소비하고 생산하는 것. Flex 클라이언트는이 클래스의 문자열을 보내고 가져올 수 있습니다. 내가하고 싶은 일은 동일한 변수에 대한 액세스 권한을 가진 2 명의 클라이언트를 갖는 것입니다.이 원시 샘플에서는 string에 _players 서버 측을 추가하는 각 swf에서 GUID를 보냅니다. Swf A를 실행하면 Swf B와 마찬가지로 GUID를 다시 수신합니다. Swf A는 Swf B에서 guid를 받지만 Swf B는 Swf A를 수신하지 않습니다. BTW 이것은 방금 두 번 실행 한 swf 코드입니다 각각은 다른 브라우저에 있습니다.단일 자바 클래스에 여러 플렉스 클라이언트 연결
누구나 내가 잘못 가고있는 곳이나 더 나은 해결책을 찾을 수 있습니까?
public class GameFeed {
private static GaneFeedThread thread;
private final MessageTemplate template;
public GameFeed(MessageTemplate template) {
this.template = template;
}
public void start() {
if (thread == null) {
thread = new GaneFeedThread(this.template);
thread.start();
}
}
public void stop() {
thread.running = false;
thread = null;
}
public static class GaneFeedThread extends Thread {
public boolean running = false;
private final MessageTemplate template;
public GaneFeedThread(MessageTemplate template) {
this.template = template;
}
private static String _players;
public void addPlayer(String name)
{
_players += name + ",";
}
while (this.running) {
this.template.send("game-feed", _players);
}
동기화 된 블록에 사용되는 모니터를 선택하십시오. '이'가 될 수 없습니다. – Ralph
감사합니다. 결국 문제를 발견했지만 도움을 주셔서 감사합니다. 문제는 실제로 매우 바보스럽고 가변 범위로 인해 발생했습니다. 변수를 GameFeed 클래스로 옮겼습니다. 클라이언트가 활성화 한 Thread 클래스와 반대로 잘 동작했습니다. – MikeW