Qual è il modello / logica dietro a generare UID per i messaggi quando si utilizza server POP3?
Domanda
Questa domanda è per curiosità, JavaMail API fornisce fornitore protocollo POP3 per i messaggi accesso POP3. C'è un metodo POP3Folder.getUID (messaggio) disponibili che stringa di ritorno ID univoco per un messaggio. Si ritorna, per esempio, nel seguente formato:
Esempio UID: 1322488254.15180.1.dummy1,S=703
Le mie domande sono:
- C'è qualche logica / modello / algoritmo dietro nel generare questo
UID
univoco per ogni messaggio? - Ci sono di probabilità / probabilità di avere lo stesso UID per messaggi multipli? In altre parole, è questo davvero unico?
- E 'questo UID è generato dal provider di POP3 (JavaMail API) o restituito dal server POP3?
JavaMail API doc dice:
Return the unique ID string for this message, or null if not available. Uses the POP3 UIDL command.
Soluzione
It's generated by the POP3 server. Every server does it differently. How perfectly it does it depends on the server, but generally I wouldn't worry about getting the same UID for two different messages. Depending on anything about the content or structure of the UID would be a mistake. In particular, don't assume that they're sorted.