style: Field order, whitespace, spelling.

This commit is contained in:
Boris Grozev 2016-11-30 10:51:55 -06:00
parent 6603ac3c28
commit d0afb0a55b
5 changed files with 95 additions and 93 deletions

View File

@ -761,9 +761,9 @@ public class Agent
*/ */
public void addStateChangeListener(PropertyChangeListener l) public void addStateChangeListener(PropertyChangeListener l)
{ {
synchronized(stateListeners) synchronized (stateListeners)
{ {
if(!stateListeners.contains(l)) if (!stateListeners.contains(l))
stateListeners.add(l); stateListeners.add(l);
} }
} }
@ -776,7 +776,7 @@ public class Agent
*/ */
public void removeStateChangeListener(PropertyChangeListener l) public void removeStateChangeListener(PropertyChangeListener l)
{ {
synchronized(stateListeners) synchronized (stateListeners)
{ {
stateListeners.remove(l); stateListeners.remove(l);
} }
@ -794,7 +794,7 @@ public class Agent
{ {
PropertyChangeListener[] stateListenersCopy; PropertyChangeListener[] stateListenersCopy;
synchronized(stateListeners) synchronized (stateListeners)
{ {
stateListenersCopy stateListenersCopy
= stateListeners.toArray(NO_STATE_CHANGE_LISTENERS); = stateListeners.toArray(NO_STATE_CHANGE_LISTENERS);
@ -808,7 +808,7 @@ public class Agent
PROPERTY_ICE_PROCESSING_STATE, PROPERTY_ICE_PROCESSING_STATE,
oldState, newState); oldState, newState);
for(PropertyChangeListener l : stateListenersCopy) for (PropertyChangeListener l : stateListenersCopy)
l.propertyChange(evt); l.propertyChange(evt);
} }
} }

View File

@ -290,13 +290,13 @@ public class CandidatePair
this.state = newState; this.state = newState;
if(newState == CandidatePairState.IN_PROGRESS) if (newState == CandidatePairState.IN_PROGRESS)
{ {
if (tranID == null) if (tranID == null)
{ {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Putting a pair into the In-Progress state MUST be" "Putting a pair into the In-Progress state MUST be"
+ " accomapnied with the TransactionID of the" + " accompanied with the TransactionID of the"
+ " connectivity check."); + " connectivity check.");
} }
} }

View File

@ -175,7 +175,7 @@ class ConnectivityCheckClient
indication, indication,
candidatePair.getRemoteCandidate().getTransportAddress(), candidatePair.getRemoteCandidate().getTransportAddress(),
localCandidate.getBase().getTransportAddress()); localCandidate.getBase().getTransportAddress());
if(logger.isLoggable(Level.FINEST)) if (logger.isLoggable(Level.FINEST))
{ {
logger.finest( logger.finest(
"sending binding indication to pair " + candidatePair); "sending binding indication to pair " + candidatePair);
@ -185,7 +185,7 @@ class ConnectivityCheckClient
{ {
IceSocketWrapper stunSocket = localCandidate.getStunSocket(null); IceSocketWrapper stunSocket = localCandidate.getStunSocket(null);
if(stunSocket != null) if (stunSocket != null)
{ {
logger.log( logger.log(
Level.INFO, Level.INFO,
@ -282,7 +282,7 @@ class ConnectivityCheckClient
.getParentComponent().getParentStream().getName(); .getParentComponent().getParentStream().getName();
String localUserName = parentAgent.generateLocalUserName(media); String localUserName = parentAgent.generateLocalUserName(media);
if(localUserName == null) if (localUserName == null)
return null; return null;
UsernameAttribute unameAttr UsernameAttribute unameAttr
@ -322,7 +322,7 @@ class ConnectivityCheckClient
originalWaitInterval, originalWaitInterval,
maxWaitInterval, maxWaitInterval,
maxRetransmissions); maxRetransmissions);
if(logger.isLoggable(Level.FINEST)) if (logger.isLoggable(Level.FINEST))
{ {
logger.finest( logger.finest(
"checking pair " + candidatePair + " tid " + tran); "checking pair " + candidatePair + " tid " + tran);
@ -334,13 +334,13 @@ class ConnectivityCheckClient
IceSocketWrapper stunSocket = localCandidate.getStunSocket(null); IceSocketWrapper stunSocket = localCandidate.getStunSocket(null);
if(stunSocket != null) if (stunSocket != null)
{ {
String msg String msg
= "Failed to send " + request + " through " = "Failed to send " + request + " through "
+ stunSocket.getLocalSocketAddress() + "."; + stunSocket.getLocalSocketAddress() + ".";
if((ex instanceof NoRouteToHostException) if ((ex instanceof NoRouteToHostException)
|| (ex.getMessage() != null || (ex.getMessage() != null
&& ex.getMessage().equals("No route to host"))) && ex.getMessage().equals("No route to host")))
{ {
@ -383,9 +383,9 @@ class ConnectivityCheckClient
char messageType = response.getMessageType(); char messageType = response.getMessageType();
//handle error responses. //handle error responses.
if(messageType == Response.BINDING_ERROR_RESPONSE) if (messageType == Response.BINDING_ERROR_RESPONSE)
{ {
if(!response.containsAttribute(Attribute.ERROR_CODE)) if (!response.containsAttribute(Attribute.ERROR_CODE))
{ {
logger.fine("Received a malformed error response."); logger.fine("Received a malformed error response.");
return; //malformed error response return; //malformed error response
@ -394,7 +394,7 @@ class ConnectivityCheckClient
processErrorResponse(ev); processErrorResponse(ev);
} }
//handle success responses. //handle success responses.
else if(messageType == Response.BINDING_SUCCESS_RESPONSE) else if (messageType == Response.BINDING_SUCCESS_RESPONSE)
{ {
processSuccessResponse(ev); processSuccessResponse(ev);
} }
@ -419,12 +419,12 @@ class ConnectivityCheckClient
= checkedPair.getParentComponent().getParentStream(); = checkedPair.getParentComponent().getParentStream();
final CheckList checkList = stream.getCheckList(); final CheckList checkList = stream.getCheckList();
if(stream.getParentAgent().getState().isEstablished()) if (stream.getParentAgent().getState().isEstablished())
return; return;
//If all of the pairs in the check list are now either in the Failed or //If all of the pairs in the check list are now either in the Failed or
//Succeeded state: //Succeeded state:
if(checkList.allChecksCompleted()) if (checkList.allChecksCompleted())
{ {
//If there is not a pair in the valid list for each component of the //If there is not a pair in the valid list for each component of the
//media stream, the state of the check list is set to Failed. //media stream, the state of the check list is set to Failed.
@ -433,7 +433,7 @@ class ConnectivityCheckClient
final String streamName = stream.getName(); final String streamName = stream.getName();
Timer timer = timers.get(streamName); Timer timer = timers.get(streamName);
if(timer == null) if (timer == null)
{ {
logger.info("CheckList will failed in a few seconds if no" + logger.info("CheckList will failed in a few seconds if no" +
"succeeded checks come"); "succeeded checks come");
@ -443,7 +443,7 @@ class ConnectivityCheckClient
@Override @Override
public void run() public void run()
{ {
if(checkList.getState() != CheckListState.COMPLETED) if (checkList.getState() != CheckListState.COMPLETED)
{ {
logger.info("CheckList for stream " + logger.info("CheckList for stream " +
streamName + " FAILED"); streamName + " FAILED");
@ -471,7 +471,7 @@ class ConnectivityCheckClient
{ {
CheckList anotherCheckList = anotherStream.getCheckList(); CheckList anotherCheckList = anotherStream.getCheckList();
if(anotherCheckList.isFrozen()) if (anotherCheckList.isFrozen())
{ {
anotherCheckList.computeInitialCheckListPairStates(); anotherCheckList.computeInitialCheckListPairStates();
startChecks(anotherCheckList); startChecks(anotherCheckList);
@ -609,8 +609,11 @@ class ConnectivityCheckClient
//Succeeded. Note that, the pair which *generated* the check may be //Succeeded. Note that, the pair which *generated* the check may be
//different than the valid pair constructed above //different than the valid pair constructed above
if (checkedPair.getParentComponent().getSelectedPair() == null) if (checkedPair.getParentComponent().getSelectedPair() == null)
{
logger.info("Pair succeeded: " + checkedPair.toShortString() logger.info("Pair succeeded: " + checkedPair.toShortString()
+ ". Local ufrag " + parentAgent.getLocalUfrag()); + ". Local ufrag "
+ parentAgent.getLocalUfrag());
}
checkedPair.setStateSucceeded(); checkedPair.setStateSucceeded();
} }
@ -627,12 +630,12 @@ class ConnectivityCheckClient
IceMediaStream parentStream IceMediaStream parentStream
= checkedPair.getParentComponent().getParentStream(); = checkedPair.getParentComponent().getParentStream();
synchronized(this) synchronized (this)
{ {
Vector<CandidatePair> parentCheckList Vector<CandidatePair> parentCheckList
= new Vector<>(parentStream.getCheckList()); = new Vector<>(parentStream.getCheckList());
for(CandidatePair pair : parentCheckList) for (CandidatePair pair : parentCheckList)
{ {
if (pair.getState() == CandidatePairState.FROZEN if (pair.getState() == CandidatePairState.FROZEN
&& checkedPair.getFoundation().equals( && checkedPair.getFoundation().equals(
@ -699,7 +702,7 @@ class ConnectivityCheckClient
if (parentAgent.isControlling() if (parentAgent.isControlling()
&& request.containsAttribute(Attribute.USE_CANDIDATE)) && request.containsAttribute(Attribute.USE_CANDIDATE))
{ {
if(validPair.getParentComponent().getSelectedPair() == null) if (validPair.getParentComponent().getSelectedPair() == null)
{ {
logger.info("Nomination confirmed for pair: " logger.info("Nomination confirmed for pair: "
+ validPair.toShortString() + validPair.toShortString()
@ -721,7 +724,7 @@ class ConnectivityCheckClient
&& checkedPair.useCandidateReceived() && checkedPair.useCandidateReceived()
&& !checkedPair.isNominated()) && !checkedPair.isNominated())
{ {
if(checkedPair.getParentComponent().getSelectedPair() == null) if (checkedPair.getParentComponent().getSelectedPair() == null)
{ {
logger.info( logger.info(
"Nomination confirmed for pair: " "Nomination confirmed for pair: "
@ -800,12 +803,12 @@ class ConnectivityCheckClient
logger.finer("Received error code " + ((int) errorCode)); logger.finer("Received error code " + ((int) errorCode));
//RESOLVE ROLE_CONFLICTS //RESOLVE ROLE_CONFLICTS
if(errorCode == ErrorCodeAttribute.ROLE_CONFLICT) if (errorCode == ErrorCodeAttribute.ROLE_CONFLICT)
{ {
boolean wasControlling boolean wasControlling
= originalRequest.containsAttribute(Attribute.ICE_CONTROLLING); = originalRequest.containsAttribute(Attribute.ICE_CONTROLLING);
logger.finer("Swithing to isControlling=" + !wasControlling); logger.finer("Switching to isControlling=" + !wasControlling);
parentAgent.setControlling(!wasControlling); parentAgent.setControlling(!wasControlling);
pair.getParentComponent().getParentStream().getCheckList() pair.getParentComponent().getParentStream().getCheckList()
@ -916,7 +919,7 @@ class ConnectivityCheckClient
{ {
long waitFor = getNextWaitInterval(); long waitFor = getNextWaitInterval();
if(waitFor > 0) if (waitFor > 0)
{ {
/* /*
* waitFor will be 0 for the first check since we won't * waitFor will be 0 for the first check since we won't
@ -939,10 +942,10 @@ class ConnectivityCheckClient
CandidatePair pairToCheck = checkList.popTriggeredCheck(); CandidatePair pairToCheck = checkList.popTriggeredCheck();
//if there are no triggered checks, go for an ordinary one. //if there are no triggered checks, go for an ordinary one.
if(pairToCheck == null) if (pairToCheck == null)
pairToCheck = checkList.getNextOrdinaryPairToCheck(); pairToCheck = checkList.getNextOrdinaryPairToCheck();
if(pairToCheck != null) if (pairToCheck != null)
{ {
/* /*
* Since we suspect that it is possible to * Since we suspect that it is possible to
@ -956,7 +959,7 @@ class ConnectivityCheckClient
TransactionID transactionID TransactionID transactionID
= startCheckForPair(pairToCheck); = startCheckForPair(pairToCheck);
if(transactionID == null) if (transactionID == null)
{ {
logger.info( logger.info(
"Pair failed: " "Pair failed: "
@ -983,7 +986,7 @@ class ConnectivityCheckClient
{ {
synchronized (paceMakers) synchronized (paceMakers)
{ {
synchronized(this) synchronized (this)
{ {
paceMakers.remove(this); paceMakers.remove(this);
} }
@ -1005,7 +1008,7 @@ class ConnectivityCheckClient
{ {
PaceMaker paceMaker = paceMakersIter.next(); PaceMaker paceMaker = paceMakersIter.next();
synchronized(paceMaker) synchronized (paceMaker)
{ {
paceMaker.running = false; paceMaker.running = false;
paceMaker.notify(); paceMaker.notify();

View File

@ -52,7 +52,7 @@ public class DefaultNominator
/** /**
* Map that will remember association between validated relayed candidate * Map that will remember association between validated relayed candidate
* and a timer. It is use with the NOMINATE_FIRST_HIGHEST_VALID strategy. * and a timer. It is used with the NOMINATE_FIRST_HIGHEST_VALID strategy.
*/ */
private final Map<String, TimerTask> validatedCandidates = new HashMap<>(); private final Map<String, TimerTask> validatedCandidates = new HashMap<>();
@ -86,12 +86,12 @@ public class DefaultNominator
{ {
String propertyName = ev.getPropertyName(); String propertyName = ev.getPropertyName();
if(Agent.PROPERTY_ICE_PROCESSING_STATE.equals(propertyName)) if (Agent.PROPERTY_ICE_PROCESSING_STATE.equals(propertyName))
{ {
if(ev.getNewValue() != IceProcessingState.RUNNING) if (ev.getNewValue() != IceProcessingState.RUNNING)
return; return;
for(IceMediaStream stream : parentAgent.getStreams()) for (IceMediaStream stream : parentAgent.getStreams())
{ {
stream.addPairChangeListener(this); stream.addPairChangeListener(this);
stream.getCheckList().addStateChangeListener(this); stream.getCheckList().addStateChangeListener(this);
@ -104,7 +104,7 @@ public class DefaultNominator
return; return;
} }
if(ev.getSource() instanceof CandidatePair) if (ev.getSource() instanceof CandidatePair)
{ {
// STUN Usage for Consent Freshness is of no concern here. // STUN Usage for Consent Freshness is of no concern here.
if (IceMediaStream.PROPERTY_PAIR_CONSENT_FRESHNESS_CHANGED.equals( if (IceMediaStream.PROPERTY_PAIR_CONSENT_FRESHNESS_CHANGED.equals(
@ -115,7 +115,7 @@ public class DefaultNominator
// do not nominate pair if there is currently a selected pair for // do not nominate pair if there is currently a selected pair for
// the component // the component
if(validPair.getParentComponent().getSelectedPair() != null) if (validPair.getParentComponent().getSelectedPair() != null)
{ {
logger.fine( logger.fine(
"Keep-alive for pair: " + validPair.toShortString()); "Keep-alive for pair: " + validPair.toShortString());
@ -141,7 +141,8 @@ public class DefaultNominator
*/ */
private void strategyNominateFirstValid(PropertyChangeEvent evt) private void strategyNominateFirstValid(PropertyChangeEvent evt)
{ {
if(IceMediaStream.PROPERTY_PAIR_VALIDATED.equals(evt.getPropertyName())) if (IceMediaStream.PROPERTY_PAIR_VALIDATED
.equals(evt.getPropertyName()))
{ {
CandidatePair validPair = (CandidatePair)evt.getSource(); CandidatePair validPair = (CandidatePair)evt.getSource();
@ -163,7 +164,7 @@ public class DefaultNominator
{ {
String pname = ev.getPropertyName(); String pname = ev.getPropertyName();
if(IceMediaStream.PROPERTY_PAIR_VALIDATED.equals(pname) if (IceMediaStream.PROPERTY_PAIR_VALIDATED.equals(pname)
|| (IceMediaStream.PROPERTY_PAIR_STATE_CHANGED.equals(pname) || (IceMediaStream.PROPERTY_PAIR_STATE_CHANGED.equals(pname)
&& (ev.getNewValue() == CandidatePairState.FAILED))) && (ev.getNewValue() == CandidatePairState.FAILED)))
{ {
@ -172,14 +173,14 @@ public class DefaultNominator
IceMediaStream parentStream = parentComponent.getParentStream(); IceMediaStream parentStream = parentComponent.getParentStream();
CheckList parentCheckList = parentStream.getCheckList(); CheckList parentCheckList = parentStream.getCheckList();
if(!parentCheckList.allChecksCompleted()) if (!parentCheckList.allChecksCompleted())
return; return;
for(Component component : parentStream.getComponents()) for (Component component : parentStream.getComponents())
{ {
CandidatePair pair = parentStream.getValidPair(component); CandidatePair pair = parentStream.getValidPair(component);
if(pair != null) if (pair != null)
{ {
logger.info( logger.info(
"Nominate (highest priority): " "Nominate (highest priority): "
@ -215,7 +216,7 @@ public class DefaultNominator
private void strategyNominateFirstHostOrReflexiveValid( private void strategyNominateFirstHostOrReflexiveValid(
PropertyChangeEvent evt) PropertyChangeEvent evt)
{ {
if(IceMediaStream.PROPERTY_PAIR_VALIDATED.equals(evt.getPropertyName())) if (IceMediaStream.PROPERTY_PAIR_VALIDATED.equals(evt.getPropertyName()))
{ {
CandidatePair validPair = (CandidatePair) evt.getSource(); CandidatePair validPair = (CandidatePair) evt.getSource();
@ -229,12 +230,12 @@ public class DefaultNominator
CandidateType.RELAYED_CANDIDATE); CandidateType.RELAYED_CANDIDATE);
boolean nominate = false; boolean nominate = false;
synchronized(validatedCandidates) synchronized (validatedCandidates)
{ {
TimerTask task TimerTask task
= validatedCandidates.get(component.toShortString()); = validatedCandidates.get(component.toShortString());
if(isRelayed && task == null) if (isRelayed && task == null)
{ {
/* armed a timer and see if a host or server reflexive pair /* armed a timer and see if a host or server reflexive pair
* gets nominated. Otherwise nominate the relayed candidate * gets nominated. Otherwise nominate the relayed candidate
@ -247,10 +248,10 @@ public class DefaultNominator
timer.schedule(task, 0); timer.schedule(task, 0);
validatedCandidates.put(component.toShortString(), task); validatedCandidates.put(component.toShortString(), task);
} }
else if(!isRelayed) else if (!isRelayed)
{ {
// host or server reflexive candidate pair // host or server reflexive candidate pair
if(task != null) if (task != null)
{ {
task.cancel(); task.cancel();
logger.info( logger.info(
@ -265,7 +266,7 @@ public class DefaultNominator
} }
} }
if(nominate) if (nominate)
parentAgent.nominate(validPair); parentAgent.nominate(validPair);
} }
} }
@ -314,18 +315,17 @@ public class DefaultNominator
*/ */
public void propertyChange(PropertyChangeEvent evt) public void propertyChange(PropertyChangeEvent evt)
{ {
/* check list has running out of ordinary checks, see if all other // check list has running out of ordinary checks, see if all other
* candidates are FAILED, in which case we nominate immediately // candidates are FAILED, in which case we nominate immediately
* the relayed candidate // the relayed candidate
*/
CheckList checkList = (CheckList)evt.getSource(); CheckList checkList = (CheckList)evt.getSource();
boolean allFailed = true; boolean allFailed = true;
synchronized(checkList) synchronized (checkList)
{ {
for(CandidatePair c : checkList) for (CandidatePair c : checkList)
{ {
if(c != pair && c.getState() != CandidatePairState.FAILED) if (c != pair && c.getState() != CandidatePairState.FAILED)
{ {
allFailed = false; allFailed = false;
break; break;
@ -365,7 +365,7 @@ public class DefaultNominator
{ {
Thread.sleep(WAIT_TIME); Thread.sleep(WAIT_TIME);
} }
catch(InterruptedException e) catch (InterruptedException e)
{ {
cancelled = true; cancelled = true;
} }
@ -376,7 +376,7 @@ public class DefaultNominator
this); this);
validatedCandidates.remove(component.toShortString()); validatedCandidates.remove(component.toShortString());
if(cancelled) if (cancelled)
return; return;
logger.info( logger.info(

View File

@ -68,6 +68,19 @@ public class IceMediaStream
*/ */
public static final String PROPERTY_PAIR_VALIDATED = "PairValidated"; public static final String PROPERTY_PAIR_VALIDATED = "PairValidated";
/**
* Use builder pattern to provide an immutable IceMediaStream instance.
*
* @param name the name of the media stream
* @param parentAgent the agent that is handling the session that this
* media stream is a part of
* @return IceMediaStream
*/
public static IceMediaStream build(Agent parentAgent, String name)
{
return new IceMediaStream(parentAgent, name);
}
/** /**
* The name of this media stream. The name is equal to the value specified * The name of this media stream. The name is equal to the value specified
* in the SDP description. * in the SDP description.
@ -557,12 +570,12 @@ public class IceMediaStream
{ {
synchronized(checkList) synchronized(checkList)
{ {
for( CandidatePair pair : checkList) for (CandidatePair pair : checkList)
{ {
if( pair.getLocalCandidate().getTransportAddress() if (pair.getLocalCandidate().getTransportAddress()
.equals(localAddress) .equals(localAddress)
&& pair.getRemoteCandidate().getTransportAddress() && pair.getRemoteCandidate().getTransportAddress()
.equals(remoteAddress) ) .equals(remoteAddress))
{ {
return pair; return pair;
} }
@ -587,12 +600,12 @@ public class IceMediaStream
{ {
synchronized(checkList) synchronized(checkList)
{ {
for( CandidatePair pair : checkList) for (CandidatePair pair : checkList)
{ {
LocalCandidate local = pair.getLocalCandidate(); LocalCandidate local = pair.getLocalCandidate();
RemoteCandidate remote = pair.getRemoteCandidate(); RemoteCandidate remote = pair.getRemoteCandidate();
if(local.getUfrag().equals(remoteUFrag) if (local.getUfrag().equals(remoteUFrag)
&& remote.getUfrag().equals(localUFrag)) && remote.getUfrag().equals(localUFrag))
{ {
return pair; return pair;
@ -613,7 +626,7 @@ public class IceMediaStream
synchronized (components) synchronized (components)
{ {
for(Component cmp : components.values()) for (Component cmp : components.values())
num += cmp.countLocalHostCandidates(); num += cmp.countLocalHostCandidates();
} }
@ -645,7 +658,7 @@ public class IceMediaStream
{ {
synchronized (validList) synchronized (validList)
{ {
if(!validList.contains(pair)) if (!validList.contains(pair))
validList.add(pair); validList.add(pair);
} }
@ -666,7 +679,7 @@ public class IceMediaStream
{ {
synchronized(validList) synchronized(validList)
{ {
for(CandidatePair pair : validList) for (CandidatePair pair : validList)
{ {
if (pair.getFoundation().equals(foundation)) if (pair.getFoundation().equals(foundation))
return true; return true;
@ -714,7 +727,7 @@ public class IceMediaStream
*/ */
protected boolean validListContainsAllComponents() protected boolean validListContainsAllComponents()
{ {
for(Component cmp : getComponents()) for (Component cmp : getComponents())
{ {
if (getValidPair(cmp) == null) if (getValidPair(cmp) == null)
{ {
@ -762,9 +775,9 @@ public class IceMediaStream
*/ */
protected boolean allComponentsHaveSelected() protected boolean allComponentsHaveSelected()
{ {
for(Component component : getComponents()) for (Component component : getComponents())
{ {
if(component.getSelectedPair() == null) if (component.getSelectedPair() == null)
return false; return false;
} }
return true; return true;
@ -782,11 +795,11 @@ public class IceMediaStream
*/ */
protected CandidatePair getValidPair(Component component) protected CandidatePair getValidPair(Component component)
{ {
synchronized(validList) synchronized (validList)
{ {
for(CandidatePair pair : validList) for (CandidatePair pair : validList)
{ {
if(pair.getParentComponent() == component) if (pair.getParentComponent() == component)
return pair; return pair;
} }
} }
@ -803,9 +816,9 @@ public class IceMediaStream
*/ */
public void addPairChangeListener(PropertyChangeListener l) public void addPairChangeListener(PropertyChangeListener l)
{ {
synchronized(streamListeners) synchronized (streamListeners)
{ {
if(!streamListeners.contains(l)) if (!streamListeners.contains(l))
streamListeners.add(l); streamListeners.add(l);
} }
} }
@ -818,7 +831,7 @@ public class IceMediaStream
*/ */
public void removePairStateChangeListener(PropertyChangeListener l) public void removePairStateChangeListener(PropertyChangeListener l)
{ {
synchronized(streamListeners) synchronized (streamListeners)
{ {
streamListeners.remove(l); streamListeners.remove(l);
} }
@ -840,7 +853,7 @@ public class IceMediaStream
{ {
PropertyChangeListener[] ls; PropertyChangeListener[] ls;
synchronized(streamListeners) synchronized (streamListeners)
{ {
ls ls
= streamListeners.toArray( = streamListeners.toArray(
@ -850,7 +863,7 @@ public class IceMediaStream
PropertyChangeEvent ev PropertyChangeEvent ev
= new PropertyChangeEvent(source, propertyName, oldValue, newValue); = new PropertyChangeEvent(source, propertyName, oldValue, newValue);
for(PropertyChangeListener l : ls) for (PropertyChangeListener l : ls)
l.propertyChange(ev); l.propertyChange(ev);
} }
@ -898,18 +911,4 @@ public class IceMediaStream
{ {
return remotePassword; return remotePassword;
} }
/**
* Use builder pattern to provide an immutable IceMediaStream instance.
*
* @param name the name of the media stream
* @param parentAgent the agent that is handling the session that this
* media stream is a part of
* @return IceMediaStream
*/
public static IceMediaStream build(Agent parentAgent, String name)
{
return new IceMediaStream(parentAgent, name);
}
} }